Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. on .NET Framework 4.7.1 #381

Closed
jemiller0 opened this issue Oct 28, 2017 · 3 comments

Comments

@jemiller0
Copy link

@jemiller0 jemiller0 commented Oct 28, 2017

I'm in the process of trying to upgrade my applications to .NET Framework 4.7.1 and I ran into the following warning when building the apps.

1>------ Rebuild All started: Project: ConsoleApp7, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1988,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
1>  ConsoleApp7 -> C:\Users\jemiller\Documents\Visual Studio 2017\Projects\ConsoleApp7\ConsoleApp7\bin\Debug\ConsoleApp7.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

If you set Tools|Options|Projects and Solutions|Build and Run|MSBuild project build output verbosity to Detailed you can see that it appears that there is a conflict with System.Runtime.InteropServices.RuntimeInformation.

1>  There was a conflict between "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>      "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
1>      References which depend on "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Users\jemiller\Documents\Visual Studio 2017\Projects\ConsoleApp7\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll].
1>          C:\Users\jemiller\Documents\Visual Studio 2017\Projects\ConsoleApp7\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll
1>            Project file item includes which caused reference "C:\Users\jemiller\Documents\Visual Studio 2017\Projects\ConsoleApp7\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll".
1>              System.Runtime.InteropServices.RuntimeInformation
1>      References which depend on "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\Facades\System.Runtime.InteropServices.RuntimeInformation.dll].
1>          C:\Users\jemiller\Documents\Visual Studio 2017\Projects\ConsoleApp7\packages\MySqlConnector.0.29.2\lib\net46\MySqlConnector.dll
1>            Project file item includes which caused reference "C:\Users\jemiller\Documents\Visual Studio 2017\Projects\ConsoleApp7\packages\MySqlConnector.0.29.2\lib\net46\MySqlConnector.dll".
1>              MySqlConnector, Version=0.29.2.0, Culture=neutral, processorArchitecture=MSIL
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1988,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

Is there something that can be done with the NuGet package to eliminate this warning? I tested this by creating a .NET Framework 4.7.1 console application with nothing else in it and right after adding the latest MySqlConnector package, it gives the errors when you do a build. Also, I tried updating the dependent packages since there were updates and the problem still occurs.

@bgrainger
Copy link
Member

@bgrainger bgrainger commented Oct 28, 2017

I can reproduce this problem with both a "traditional" CSPROJ and a new "Sdk-style" CSPROJ file. It looks like C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\Facades\System.Runtime.InteropServices.RuntimeInformation.dll is new in .NET 4.7.1 (and not present in the v4.7 folder) so I wonder if it's part of the problem.

@bgrainger
Copy link
Member

@bgrainger bgrainger commented Oct 28, 2017

One solution would be to remove the System.Runtime.InteropServices.RuntimeInformation dependency for the net45 and net46 builds (and only use it for netstandard). It appears that a S.R.IS.RI dependency causes problems with mono on Mac (dotnet/corefx#9012) so eliminating it could have additional benefits.

@jemiller0
Copy link
Author

@jemiller0 jemiller0 commented Oct 28, 2017

Wow! Great work! I still had the NuGet screen up in Visual Studio from this morning and it displayed that an update was available. I didn't even have to scan for updates or anything. Just clicked Update, and it appears to have worked like a charm. No more warning. I think I may be using other packages that have similar problems, but, at least this one is fixed. Thanks for the quick response. Job well done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants