Could not load file or assembly 'System.Net.Ht

2019-06-25 08:58发布

I don't know what I did, but I may have removed System.Net.Http 4.0.0.0 from the GAC. I have a Windows Portable Library that targets WinRT that was compiling and working fine, and now I get the following error every time I try and run it

Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

how can I re-add System.Net.Http 4.0.0.0? Every time I look for the .dll, I find the 2.0.0.0 version?

4条回答
Rolldiameter
2楼-- · 2019-06-25 09:09

Have you tried to delete, then re-add the reference from the project?

查看更多
仙女界的扛把子
3楼-- · 2019-06-25 09:26

To repair this on versions of Windows prior to Windows 8, go to Add or Remove Programs and do a repair install of the .NET Framework 4.5.

To pair this on versions Windows 8 or greater, you will need to run System Restore to restore Windows binaries to an earlier version when it did work.

查看更多
贼婆χ
4楼-- · 2019-06-25 09:31

If it was but now is not, is high likely that you changed something in your project, if i understand correctly you're creating a Portable Library (not a Windows Store one), if that's the case, probably you changed what plataforms you're targeting, open the Properties of the project and in Library->Target Frameworks click on Change, there, if you have everything selected or .NET Framework 4.0.3 is selected, then System.Net.Http is not allowed, to solve this, you need to quit some selections and enable the .NET Framework 4.5, as this the minimum version to use System.Net.Http.

查看更多
淡お忘
5楼-- · 2019-06-25 09:32

Try folder:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0
and copy the dll into GAC using gacutil tool from folder
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

查看更多
登录 后发表回答