question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning when building with `AutoGenerateBindingRedirects` (Found conflicts between different versions of ...)

See original GitHub issue

Describe the bug When building with flag AutoGenerateBindingRedirects to true we get warnings

PS D:\temp\ReproFluentMigrator> dotnet build
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored D:\temp\ReproFluentMigrator\Repro.csproj (in 199 ms).
C:\Program Files\dotnet\sdk\5.0.101\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Data.SqlClient" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\temp\ReproFluentMigrator\Repro.csproj]
C:\Program Files\dotnet\sdk\5.0.101\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Security.AccessControl" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\temp\ReproFluentMigrator\Repro.csproj]
C:\Program Files\dotnet\sdk\5.0.101\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Security.Permissions" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\temp\ReproFluentMigrator\Repro.csproj]
C:\Program Files\dotnet\sdk\5.0.101\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Security.Principal.Windows" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\temp\ReproFluentMigrator\Repro.csproj]
  Repro -> D:\temp\ReproFluentMigrator\bin\Debug\netcoreapp3.1\Repro.dll

Build succeeded.

C:\Program Files\dotnet\sdk\5.0.101\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Data.SqlClient" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\temp\ReproFluentMigrator\Repro.csproj]
C:\Program Files\dotnet\sdk\5.0.101\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Security.AccessControl" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\temp\ReproFluentMigrator\Repro.csproj]
C:\Program Files\dotnet\sdk\5.0.101\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Security.Permissions" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\temp\ReproFluentMigrator\Repro.csproj]
C:\Program Files\dotnet\sdk\5.0.101\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Security.Principal.Windows" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\temp\ReproFluentMigrator\Repro.csproj]
    4 Warning(s)
    0 Error(s)

To Reproduce

Just run dotnet build with the following Repro.csproj and Program.cs

csproj:

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>netcoreapp3.1</TargetFramework>
		<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
		<OutputType>Exe</OutputType>
	</PropertyGroup>
	<ItemGroup>
		<PackageReference Include="FluentMigrator.Runner" Version="3.2.9" />
	</ItemGroup>
</Project>

Program.cs

namespace Repro
{
	public class Program
	{
		static void Main(string[] args)
		{
		}
	}
}

Expected behavior No warning

Information (please complete the following information):

  • OS: Windows 10
  • Platform .NET Core 3.1
  • FluentMigrator version 3.2.9

Additional context dotnet info

PS D:\temp\ReproFluentMigrator> dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.101
 Commit:    d05174dc5a

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.101\

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  2.1.105 [C:\Program Files\dotnet\sdk]
  2.1.509 [C:\Program Files\dotnet\sdk]
  2.2.103 [C:\Program Files\dotnet\sdk]
  2.2.402 [C:\Program Files\dotnet\sdk]
  3.1.100 [C:\Program Files\dotnet\sdk]
  3.1.101 [C:\Program Files\dotnet\sdk]
  3.1.103 [C:\Program Files\dotnet\sdk]
  5.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Workaround

		<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
		<PackageReference Include="System.Security.Permissions" Version="4.7.0" />

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
jzabroskicommented, Dec 15, 2020

To elaborate, .NET Core SDK (MSBUild) generates a deps.json file which dotnet.exe uses to pass to the runtime a list of all assemblies it has to load. It does this in conjunctton with a runtimeHosts.json (or however you spell it). The “new” binding redirect is <RollForward>Major</RollForward> but it doesn’t work great. You can smooth out some issues by using a DirtyAssemblyResolveHelper (same trick you can also use in .NET Framework). The DirtyAssemblyResolveHelper trick works as long as the EXE isn’t referencing obsolete APIs that no longer exist in the new runtime’s FrameworkReference. The idea of a FrameworkReference is it basically specifies a set of “in-box” nuget packages as a “meta-package” that encapsulates all Base Class Libraries and things that used to ship into the GAC. Then, rather than assume all customers want a GAC, .NET Core takes the stance of by default allowing customers to do a “framework-dependent deployment”. Prior to .NET Core 2.1, this meant that your executable/binary copied all BCL dlls into your deployment directory. Later, they added FrameworkReference so that instead you could pull in these dependencies from a global cache, and control how “far forward” you are willing to take upgrades/hotfixes. Major RollForward means you will allow infinitely high runtime versions, but there is a very high chance you will hit missing APIs if someting is obsolete (as Entity Framework, ASP.NET and other “out-of-box” nuget packages are prone to do. Minor RollForward was nice in theory, but dumb in practice. As an example, .netcoreapp3.0 is LTS and .netcoreapp3.1 is not, but since the default is Minor RollForward, you end up rolling forward to the 3.1 runtime if it is installed. Most open source developers recommend LatestFeature RollForward because it most closely aligns with SemVer 2.0 guarantees about no breaking changes.

This is a 120 second tutorial to bring you up to speed.

0reactions
Socolincommented, Dec 17, 2020

Ok, Thanks a lot for the explanation

I thought it was working same way as before, I’ll do some research to understand this in details when I found some time.

I removed all AutoGenerateBindingRedirects from my project and it works, so I suppose I can close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: Found conflicts between different versions of the ...
This warning means that two projects reference the same assembly (e.g. System.Windows.Forms ) but the two projects require different ...
Read more >
"Found conflicts between different versions of the same ...
Common.CurrentVersion.targets(2041,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set ...
Read more >
MSB3277: Found conflicts between different versions of ' ...
This error occurs during a build when more than one version of the same dependent assembly is referenced in a build of the...
Read more >
'Found conflicts between different versions of same ...
Error message appears even when 'AutoGenerateBindingRedirects' is set to true: 'Found conflicts between different versions of same dependent assembly.
Read more >
Warning "Found conflicts between different versions of the ...
I updated our existing projects to 6.0, and now they show warnings "Found conflicts between different versions of the same dependent assembly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found