0

I'm not sure why am I getting this exception. I included System.Net.Http assembly into my C# console project. It is compiled with VS 2010 using .NET Framework 4 Client Profile.

So when I try to use HttpClient class in my code, the app works fine on my Windows 8.1 development machine, but when I run the Release build of the executable on a Windows 7 machine with .NET Framework 4 installed, I get the following exception:

enter image description here

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a or one of its dependencies. The system cannot find the file specified.

What am I missing there?

1 Answer 1

1

it seems to be an issue with the The Microsoft .NET Framework 4 Client Profile redistributable package, please try reinstalling it or updating here

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. I just tried it. It offered an option to repair it. So I did, rebooted that Win7 machine, tried my app and got the same error. So there must be something else to it?
Then probably there is an issue with the release, try to clean, build and release again. In the release verify the System.Net.Http.dll exists
Oh, shoot. You got it. for some reason VS didn't set Copy Local to true for the System.Net.Http assembly properties. So it didn't copy that DLL. OK. Now when I have that DLL copy on a Win7 machine it works. Thanks for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.