Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.The located assembly's manifest definition does not match the assembly reference. I am trying to use Newtonsoft.Json in my class library project but i get this error. i have searched everywhere but none of the solutions that i found on the internet worked for me. Does anyone have any idea ? The .csproj path :
<ItemGroup>
<Reference Include="Microsoft.Crm.Sdk.Proxy">
<HintPath>..\packages\Microsoft.CrmSdk.CoreAssemblies.6.1.1\lib\net40\Microsoft.Crm.Sdk.Proxy.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="microsoft.identitymodel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.7.0.0\lib\net35\microsoft.identitymodel.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xrm.Sdk">
<HintPath>..\packages\Microsoft.CrmSdk.CoreAssemblies.6.1.1\lib\net40\Microsoft.Xrm.Sdk.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xrm.Sdk.Workflow">
<HintPath>..\packages\Microsoft.CrmSdk.Workflow.6.1.1\lib\net40\Microsoft.Xrm.Sdk.Workflow.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Activities" />
<Reference Include="System.IdentityModel" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
the app.config binding in my project :
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Am i missing something ? I am using .Net Framework 4
Thank you
Either through the Package Managere Console or through the NuGet GUI I would uninstall/reinstall Newtonsoft.Json.
In package manager console execute: Update-Package –reinstall Newtonsoft.Json
(note this would do it for the whole solution if you have multiple projects)
You may need to do this alongside removing the dependentAssembly section for Newtonsoft in your app.config.
Also never under estimate the power of closing and reopening Visual Studio. Sometimes you can run rings around yourself looking for the answer to a problem that just goes away and has something to do with VS caching.
There're few possibilities to clean up this mess. Use one or several of them:
As said in previous reply Update-Package –reinstall Newtonsoft.Json
Uninstall Newtonsoft.Json
and all referenced packages on it + delete all binging redirects and references in csproj manually and install the package again.
Re-install all packages of the solution Update-Package -reinstall
.
Use .NET Core (the best)
Hope, it will help.
Solved this problem by linking the reference directly into the package content in .nuget\\packages\\newtonsoft.json\\12.0.1\\lib\\net40\\NewtonSoft.Json.dll
Having a reference in the package manager makes sure, the package is there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.