I have the following warning messages during build.
No way to resolve conflict between "System.ComponentModel.Annotations,
Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and
"System.ComponentModel.Annotations, Version=4.0.10.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a". Choosing
"System.ComponentModel.Annotations, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
We have around 70 C# projects (net framework 462, net core, net standard). Are there any automated tools to fix the version conflicts problem?
Related
I have a netstandard2.0 library that is used by net5.0 applications
One of packages used by the library references Microsoft.Bcl.AsyncInterfaces 5.0.0
But I get this warning for every application:
47>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2203,5):
warning MSB3277: Found conflicts between different versions of "Microsoft.Bcl.AsyncInterfaces" that could not be resolved.
There was a conflict between "Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" and "Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51".
"Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was chosen because it was primary and "Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was not.
References which depend on "Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [C:\Users\IgorBe\.nuget\packages\microsoft.bcl.asyncinterfaces\1.1.1\ref\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll].
C:\Users\IgorBe\.nuget\packages\microsoft.bcl.asyncinterfaces\1.1.1\ref\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll
Project file item includes which caused reference "C:\Users\IgorBe\.nuget\packages\microsoft.bcl.asyncinterfaces\1.1.1\ref\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll".
C:\Users\IgorBe\.nuget\packages\microsoft.bcl.asyncinterfaces\1.1.1\ref\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll
References which depend on "Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [].
Please note that "Project file item includes which caused reference" is not a project but the dll itself. My guess is that 1.0.0 version is used by compiler with .net standard to provide some core async functionality
But how can I get rid of this message? There seems to be no binding redirection for .Net 5.0
Getting the following error when attempting to build my solution. I'm fairly certain I've done it on this machine before but it's been many months. I'm not sure what might have changed in the meantime.
Assembly uses 'Microsoft.AnalysisServices.AdomdClient, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' which has a higher version than referenced assembly 'Microsoft.AnalysisServices.AdomdClient' with identity 'Microsoft.AnalysisServices.AdomdClient, Version=8.0.700.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
I have attempted to remove every mention of 8.0.700.0 from my computer via the SSDT (un)installer and manual deletion of files and registry entries and gacutil. The project is configured to use 10.0, but I cannot figure out how it even knows that a 8.0.700.0 version exists in the first place.
As far as I know, nothing remains in the registry, or the GAC, or the assemblies folders for version 8.0.700.0.
Any idea what is going on here?
Currently in the GAC
$ gacutil /l | grep Microsoft.AnalysisServices.AdomdClient,
Microsoft.AnalysisServices.AdomdClient, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL
Microsoft.AnalysisServices.AdomdClient, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL
Microsoft.AnalysisServices.AdomdClient, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL
Microsoft.AnalysisServices.AdomdClient, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL
I am trying to resolve build warnings but I cannot get past this one. I am targeting .Net 4.6.2, but it appears that ServiceStack.Interfaces is targeting a lower version? In the detailed output:
There was a conflict between "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes".
1> "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it was primary and "System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" was not.
1> References which depend on "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.dll].
1> C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.dll
1> Project file item includes which caused reference "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.dll".
Then followed by many regular assemblies which looks good, then the conflict:
1> References which depend on "System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" [].
1> C:\Code\Trunk\packages\ServiceStack.Interfaces.4.5.6\lib\portable-wp80+sl5+net45+win8+wpa81+monotouch+monoandroid+xamarin.ios10\ServiceStack.Interfaces.dll
1> Project file item includes which caused reference "C:\Code\Trunk\packages\ServiceStack.Interfaces.4.5.6\lib\portable-wp80+sl5+net45+win8+wpa81+monotouch+monoandroid+xamarin.ios10\ServiceStack.Interfaces.dll".
1> ServiceStack.Common, Version=4.5.6.0, Culture=neutral, processorArchitecture=MSIL
1> ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43, processorArchitecture=MSIL
1> ServiceStack.Redis, Version=4.5.6.0, Culture=neutral, processorArchitecture=MSIL
So it appears that ServiceStack.Interfaces is causing the problem, yet I need to reference it. Am I referencing it wrong in some way? How can I resolve the warning?
ServiceStack.Interfaces is a plain PCL library that's just built with the System.Runtime.Serialization it references using VS2017's new MSBuild format. It doesn't explicitly reference any version, the PCL build decides on what version it uses.
Once .NET Standard 2.0 and .NET Core 2.0 is released we'll be merging .NET Standard libraries together into the main ServiceStack NuGet packages in a major v5 release of ServiceStack that will replace the PCL libraries with .NET Standard which will resolve this warning, but we'll need to wait for v5 before we make any structural changes.
I was investigating a build failure recently and saw a warning about conflicts between assemblies. I dug deeper and MSBuild told me this:
There was a conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes".
"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it was primary and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" was not.`
My solution contains several console applications, lots of class libraries and ASP.NET application. We build on .NET 4.5.2.
Should I be concerned?
When using PCL libraries it is better add Microsoft.Bcl.Build Nuget package which will attempt to resolve this issue for your.
Also you should investigate dependencies of your class libraries and find where you depends on the PCL library.
I have a .NET 2.0 project and I get the following error when I try to compile some projects that use SMO:
The primary reference "Microsoft.SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0".
To resolve this problem, either remove the reference "Microsoft.SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
Can someone help. I don't want to move the projects to .NET 3.5 because of this.
Thanks
As the exceptions says the current reference assembly needs .NET 3.5. You must downgrade Microsoft.SqlServer.Smo which support .NET 2.0.