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.
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
Warning 3:
The primary reference "MySql.Data, Version=8.0.12.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" could not
be resolved because it has an indirect dependency on the assembly
"Google.Protobuf, Version=3.5.1.0, Culture=neutral,
PublicKeyToken=a7d26565bac4d604" which was built against the
".NETFramework,Version=v4.5" framework. This is a higher version than
the currently targeted framework
".NETFramework,Version=v4.0,Profile=Client".demo
Get a older Version
6.8.8 works out for me al the time
Warning 28 The primary reference "MySql.Data, Version=8.0.11.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the assembly "Google.Protobuf, Version=3.5.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". MMS
what's this error suppose to mean? plz help
Take a look at the current project properties, there is a target framework. You need to change it to 4.5 or above
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?
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.