Using Visual Studio 2017 15.5.5, I created a .NET Standard (2.0) Class Library.
To this, I added the NuGet package "Newtonsoft.Json v11.0.1-beta3" (the latest full version does not seem to support .NET Standard 2.0). When I go to the package location, I see the following file:
~.nuget\packages\newtonsoft.json\11.0.1-beta3\lib\netstandard2.0\Newtonsoft.Json.dll
However, when executing the code (in RELEASE mode only), I get the following exception:
System.IO.FileNotFoundException : Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
My project file contains:
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.1-beta3" />
The only way I could get this to work was to un-install the NuGet package and then reference the DLL directly. This is obviously not very satisfactory since NuGet offers so many advantages.
Suggestions?
EDIT Discovered that this only manifests itself in RELEASE mode. In DEBUG mode, all unit tests pass.
Try to add dependentAssembly to your
app.config
file.