0
votes

There are multiple warnings for multiple versions of same assembly are getting download at the time of build like mentioned below. Also one more point, most of these assemblies are getting downloaded because of dependencies in the Nuget.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1605): Found conflicts between different versions of the same dependent assembly.

2> There was a conflict between "Ionic.Zip, Version=1.9.1.5, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c" and "Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c". 2> "Ionic.Zip, Version=1.9.1.5, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c" was chosen because it was primary and "Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c" was not. 2> References which depend on "Ionic.Zip, Version=1.9.1.5, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c" [C:\TFS\DSCNC\Dev\CatalogServices\Background\packages\DotNetZip.1.9\lib\Ionic.Zip.dll].

One of the way to resolve this issue would be to check in the latest assembly in Packages folder.

Is there any way or configuration setting that we can prevent downloading of multiple versions of same assembly?

1
It seems that the simplest solution would be to upgrade your Nuget packages so there aren't conflicting versions of the same package in the same solution as that's usually the cause of this.Nick Nieslanik
Although solution mentioned above seems to be easy fix, but it may not be the right solution in many cases. Because multiple nuget packages could have dependency on different versions of nuget packages. So along with referencing the latest nuget package, you should also add binding redirect to the latest version added for the nuget package, so that other nugets referring to old version of nuget will redirect to latest version & there won't be build warning.Dilip Nannaware
*.config binding redirects and references that don't require specific versions are indeed needed. Well said.Nick Nieslanik

1 Answers

1
votes

As multiple nuget packages could have dependency on different versions of nuget packages. So along with referencing the latest nuget package, you should also add binding redirect to the latest version added for the nuget package, so that other nugets referring to old version of nuget will redirect to latest version & there won't be build warning.