0
votes

I have a website and dll project.

In dll packages.config I used package:
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net451" />

In web site packages.config I use package:
<package id="Microsoft.AspNet.WebApi" version="5.1.2" targetFramework="net451" />. This package has dependency "Newtonsoft.Json with version >= 4.5.11" I added also line:
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net451" />

when I launch "Update-Package -ReInstall" nuget checks that Microsoft.AspNet.WebApi depends on Newtonsoft.Json, then nuget overwrites web site packages.config with line
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net451" /> and copies Newtonsoft.Json 4.5.11 into "bin" folder of site.

Also bin folder has my dll that depends on fresh version of newtonjson and it does not work..

I tried command "Update-Package -Reinstall -IgnoreDependencies". It helped partially: now I have 6.0.3 in website/bin. But there are 2 issues: should all developers on project use only "Update-Package -Reinstall -IgnoreDependencies"? They cannot launch update of nuget from GUI? Project that not start, some dll references Newtonsoft.Json 4.5.0 (I have no exact error message because of using dependency injection).

Does anyone know:
* how to normally tell to nuget to download newtonsoft 6.0.3 to work it normally in gui? Is there any option in packages.config for this? * if I use newtonsoft json 6.0.3, should i use bindingRedirect to fix version on assembly for webapi?

Thanks a lot!!!

1

1 Answers

0
votes

OK, I found the reason of issue

After editing packages.config for dll project and Update-Package -Reinstall command for dll project, nuget downloaded right version of Newtonsoft.Json (6.0.3) for dll project, but did not refresh path in references of project. Thus solution - do not edit packages.config manually. Only launch nuget commands from package manager console or gui.

Yes, bindingRedirect helped for the second problem