I have a project in Visual Studio that targets "netstandard2.0". I add a service reference (WCF Web Service) and as a result Visual Studio (NuGet) installs for me a package reference, "System.ServiceModel.Http" version 4.4.4
When I build and run my application then the application gives an error message. In the event viewer I see the following:
*Platform: Portable. Ex: System.IO.FileNotFoundException: Could not load file or assembly 'System.ServiceModel.Http, Version=4.1.2.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'System.ServiceModel.Http, Version=4.1.2.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' *
This seems to me that the system expects version 4.1.2.3 of the assembly. Why does it think it needs another version?
I tried installing version 4.1.2.3 via NuGet, but that version doesn't seem to exist so I can not install it.
I have the feeling it has todo with the netstandard 2.0, but I can't seem to figure out how to solve this problem.
Hope someone can help me with this.
This seems to me that the system expects version 4.1.2.3 of the assembly. Why does it think it needs another version?
It is correct in asking for 4.1.2.3, but it is not asking for "another version"; package versions and library (assembly) versions are not the same thing (although many authors keep the two in sync, for simplicity). If we look here, and expand lib/netstandard2.0 and look at the file metadata for System.ServiceModel.Http.dll we see:
so 4.1.2.3 is definitely the correct version. However, the message provided doesn't sound like a mismatch; it sounds like the file is simply missing. Check whether the required dll is actually in the build output for the application.