Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to reference different NuGet package versions in a Visual Studio solution?

We are a team composed of 7 members and we want to create a Cloud Application (Windows Azure) with Visual Studio. Our application is hosted on GitHub so we have choose to use NuGet packages to keep our repository light as possible.

However two different projects in our Visual Studio solution need reference either Newtonsoft.Json version 4.0.2 or Newtonsoft.Json version 4.5.11.

We have tried to reference the right version for each project but we get this errors on build:

  1. The type 'Newtonsoft.Json.Linq.JObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Newtonsoft.Json, Version=4.0.2.0, Culture=neutral, PublicKeyToken=null'.

  2. Cannot implicitly convert type 'Newtonsoft.Json.Linq.JObject' to 'Newtonsoft.Json.Linq.JObject'

The second error suggests that there are conflicts between the two versions even if no project in our solution references the two version at the same time.

Do you have any idea to solve this problem?

Thanks.

PS: Here are the most relevant information we have found about this issue.

http://docs.nuget.org/docs/reference/known-issues

https://stackoverflow.com/search?q=NuGet+multi+packages+version

like image 237
Flabetvibes Avatar asked Mar 29 '13 22:03

Flabetvibes


People also ask

How do I change NuGet package version?

Right-click the Packages folder in the project, and select Update. This will update the NuGet package to the latest version. You can double-click the Add packages and choose the specific version.

Are NuGet packages cross platform?

In NuGet 4.8+ support for cross platform plugins has been added. This was achieved with by building a new plugin extensibility model, that has to conform to a strict set of rules of operation. The plugins are self-contained executables (runnables in the .


1 Answers

After a while... Know that we have rewrite the piece of code which use the old reference to Newtonsoft.Json version 4.0.2.

Thanks.

like image 65
Flabetvibes Avatar answered Nov 15 '22 08:11

Flabetvibes