Sdk: ResolvePackageFileConflicts is emitting confusing conflict messages when building .NET 3.5 projects.

Created on 25 Jan 2018  路  11Comments  路  Source: dotnet/sdk

Steps to Reproduce

  1. Setup environment with msbuild 15.5 or newer
  2. Create a new .NET 3.5 project
  3. Build - msbuild /t:build

Actual Results
The build output indicates there are a bunch of package conflicts

...
Using "ResolvePackageFileConflicts" task from assembly "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\\tools\net46\Microsoft.NET.Build.Extensions.Tasks.dll".
Task "ResolvePackageFileConflicts"
  Encountered conflict between 'Platform:System.DirectoryServices.AccountManagement.dll' and 'Platform:System.DirectoryServices.AccountManagement.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Net.dll' and 'Platform:System.Net.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.ComponentModel.DataAnnotations.dll' and 'Platform:System.ComponentModel.DataAnnotations.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Abstractions.dll' and 'Platform:System.Web.Abstractions.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Routing.dll' and 'Platform:System.Web.Routing.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.DynamicData.dll' and 'Platform:System.Web.DynamicData.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.DynamicData.Design.dll' and 'Platform:System.Web.DynamicData.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Extensions.Design.dll' and 'Platform:System.Web.Extensions.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Extensions.dll' and 'Platform:System.Web.Extensions.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Core.dll' and 'Platform:System.Core.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Conversion.v3.5.dll' and 'Platform:Microsoft.Build.Conversion.v3.5.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Utilities.v3.5.dll' and 'Platform:Microsoft.Build.Utilities.v3.5.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Tasks.v3.5.dll' and 'Platform:Microsoft.Build.Tasks.v3.5.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Engine.dll' and 'Platform:Microsoft.Build.Engine.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Framework.dll' and 'Platform:Microsoft.Build.Framework.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.DataSetExtensions.dll' and 'Platform:System.Data.DataSetExtensions.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.AddIn.dll' and 'Platform:System.AddIn.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.AddIn.Contract.dll' and 'Platform:System.AddIn.Contract.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Linq.dll' and 'Platform:System.Data.Linq.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Xml.Linq.dll' and 'Platform:System.Xml.Linq.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Management.Instrumentation.dll' and 'Platform:System.Management.Instrumentation.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.ServiceModel.Web.dll' and 'Platform:System.ServiceModel.Web.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.WorkflowServices.dll' and 'Platform:System.WorkflowServices.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.VisualC.STLCLR.dll' and 'Platform:Microsoft.VisualC.STLCLR.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.VisualC.STLCLR.dll' and 'Platform:Microsoft.VisualC.STLCLR.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Windows.Presentation.dll' and 'Platform:System.Windows.Presentation.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Sentinel.v3.5Client.dll' and 'Platform:Sentinel.v3.5Client.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Entity.dll' and 'Platform:System.Data.Entity.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Entity.Design.dll' and 'Platform:System.Data.Entity.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Entity.dll' and 'Platform:System.Web.Entity.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Entity.Design.dll' and 'Platform:System.Web.Entity.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Services.dll' and 'Platform:System.Data.Services.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Services.Client.dll' and 'Platform:System.Data.Services.Client.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Services.Design.dll' and 'Platform:System.Data.Services.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Engine.dll' and 'Platform:Microsoft.Build.Engine.dll'.  Choosing 'Platform:Microsoft.Build.Engine.dll' because AssemblyVersion '3.5.0.0' is greater than '2.0.0.0'.
  Encountered conflict between 'Platform:Microsoft.Build.Framework.dll' and 'Platform:Microsoft.Build.Framework.dll'.  Choosing 'Platform:Microsoft.Build.Framework.dll' because AssemblyVersion '3.5.0.0' is greater than '2.0.0.0'.
  Encountered conflict between 'Platform:MSBuild.dll' and 'Platform:MSBuild.dll'.  Choosing 'Platform:MSBuild.dll' because AssemblyVersion '3.5.0.0' is greater than '2.0.0.0'.
  Encountered conflict between 'Platform:System.DirectoryServices.AccountManagement.dll' and 'Platform:System.DirectoryServices.AccountManagement.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Net.dll' and 'Platform:System.Net.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.ComponentModel.DataAnnotations.dll' and 'Platform:System.ComponentModel.DataAnnotations.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Abstractions.dll' and 'Platform:System.Web.Abstractions.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Routing.dll' and 'Platform:System.Web.Routing.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.DynamicData.dll' and 'Platform:System.Web.DynamicData.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.DynamicData.Design.dll' and 'Platform:System.Web.DynamicData.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Extensions.Design.dll' and 'Platform:System.Web.Extensions.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Extensions.dll' and 'Platform:System.Web.Extensions.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Core.dll' and 'Platform:System.Core.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Conversion.v3.5.dll' and 'Platform:Microsoft.Build.Conversion.v3.5.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Utilities.v3.5.dll' and 'Platform:Microsoft.Build.Utilities.v3.5.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Tasks.v3.5.dll' and 'Platform:Microsoft.Build.Tasks.v3.5.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Engine.dll' and 'Platform:Microsoft.Build.Engine.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Framework.dll' and 'Platform:Microsoft.Build.Framework.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.DataSetExtensions.dll' and 'Platform:System.Data.DataSetExtensions.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.AddIn.dll' and 'Platform:System.AddIn.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.AddIn.Contract.dll' and 'Platform:System.AddIn.Contract.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Linq.dll' and 'Platform:System.Data.Linq.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Xml.Linq.dll' and 'Platform:System.Xml.Linq.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Management.Instrumentation.dll' and 'Platform:System.Management.Instrumentation.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.ServiceModel.Web.dll' and 'Platform:System.ServiceModel.Web.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.WorkflowServices.dll' and 'Platform:System.WorkflowServices.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.VisualC.STLCLR.dll' and 'Platform:Microsoft.VisualC.STLCLR.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.VisualC.STLCLR.dll' and 'Platform:Microsoft.VisualC.STLCLR.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Windows.Presentation.dll' and 'Platform:System.Windows.Presentation.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Sentinel.v3.5Client.dll' and 'Platform:Sentinel.v3.5Client.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Entity.dll' and 'Platform:System.Data.Entity.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Entity.Design.dll' and 'Platform:System.Data.Entity.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Entity.dll' and 'Platform:System.Web.Entity.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Web.Entity.Design.dll' and 'Platform:System.Web.Entity.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Services.dll' and 'Platform:System.Data.Services.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Services.Client.dll' and 'Platform:System.Data.Services.Client.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:System.Data.Services.Design.dll' and 'Platform:System.Data.Services.Design.dll'.  Could not determine winner due to equal file and assembly versions.
  Encountered conflict between 'Platform:Microsoft.Build.Engine.dll' and 'Platform:Microsoft.Build.Engine.dll'.  Choosing 'Platform:Microsoft.Build.Engine.dll' because AssemblyVersion '3.5.0.0' is greater than '2.0.0.0'.
  Encountered conflict between 'Platform:Microsoft.Build.Framework.dll' and 'Platform:Microsoft.Build.Framework.dll'.  Choosing 'Platform:Microsoft.Build.Framework.dll' because AssemblyVersion '3.5.0.0' is greater than '2.0.0.0'.
  Encountered conflict between 'Platform:MSBuild.dll' and 'Platform:MSBuild.dll'.  Choosing 'Platform:MSBuild.dll' because AssemblyVersion '3.5.0.0' is greater than '2.0.0.0'.
Done executing task "ResolvePackageFileConflicts".
...

Expected Results

  1. The conflict message itself it confusing. The message doesn't indicate what the source of the two "platform" conflicts are. I wouldn't expect the platform to have conflicts within itself.
  2. The conflict messages are the majority of the output. I would expect that the build output of a new empty project with the default verbosity would be pretty simple and understandable.

Notes of Interest:

  1. This appears to be a behavior change introduced in 15.5. The 15.4 output does not include these conflicts.
  2. The diagnostic output indicates the following TargetFrameworkDirectories are detected
  Task Parameter:
      TargetFrameworkDirectories=
          C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\
          C:\Windows\Microsoft.NET\Framework\v3.5\
          "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\"
          C:\Windows\Microsoft.NET\Framework\v3.0\
          C:\Windows\Microsoft.NET\Framework\v2.0.50727\ (TaskId:8)
  1. The C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\RedistList\FrameworkList.xml includes multiple entries for most assemblies.
...
  <File AssemblyName="System.Core" Version="3.5.0.0" PublicKeyToken="b77a5c561934e089" Culture="neutral" ProcessorArchitecture="MSIL" InGAC="false" />
  <File AssemblyName="System.Core" Version="3.5.0.0" PublicKeyToken="b77a5c561934e089" Culture="neutral" ProcessorArchitecture="MSIL" InGAC="true" />
...

Most helpful comment

Any news on this? The bug is open for almost two years... I am also struggling with megabytes worth of useless log entries.

All 11 comments

FYI - @dsplaisted @ericstj @joperezr

@joperezr I believe the only differences between 15.4 and 15.5 are the changes we took from you.

I don't think this has anything to do with my changes, this is a problem with the ConflictResolution logic which both @dsplaisted and @ericstj are more familiar with. If in fact there where no other changes than mine on 15.5, then it is very likely that this problem is not unique to that VS version, and will most likely repro on older versions as well, we probably didn't catch it before because we usually don't target 3.5

From my cursory look at the code, this problem appears to have been in there from the beginning. The v3.5 FrameworkList.xml file has 2 entries for assemblies, one for "inGac=true" and one for "inGac=false". There doesn't appear to be any code to handle this scenario from what I can tell.

Any update on this issue and whether it is likely to be fixed?

We have to target .Net 3.5 in many of our projects and we're seeing these errors repeatedly (79,000 times in a single build!), which bloats our build log by about a third.

@catweazle9 @MichaelSimons As a workaround, can you try setting the DisableHandlePackageFileConflicts to true for projects targeting .NET Framework 3.5?

I'm getting this issue as well, building a .NET 4.0 ASP.NET application. It does reference assemblies that are .NET 3.5.

We've encountered this on our TFS 2018 CI builds when building a .NET Framework application which uses .NET Standard libraries, using the Visual Studio Build task (MSBuild).

Excerpt:

2019-03-06T07:11:21.1661481Z _HandlePackageFileConflicts:
2019-03-06T07:11:21.1661481Z C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Reference:System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' and 'Reference:System.Runtime.InteropServices.RuntimeInformation'.  NETSDK1033: Choosing 'Reference:System.Runtime.InteropServices.RuntimeInformation' because AssemblyVersion '4.0.2.0' is greater than '4.0.1.0'. [c:\agent\_work\8\s\src\SampleProject\src\DotNetFullFrameworkApplication.csproj]
2019-03-06T07:11:21.1661481Z C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Reference:System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL' and 'Reference:System.IO.Compression.ZipFile'.  NETSDK1033: Choosing 'Reference:System.IO.Compression.ZipFile' because AssemblyVersion '4.0.3.0' is greater than '4.0.2.0'. [c:\agent\_work\8\s\src\SampleProject\src\DotNetFullFrameworkApplication.csproj]
2019-03-06T07:11:21.1974031Z C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Reference:Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' and 'Platform:Microsoft.Build.Framework.dll'.  NETSDK1033: Choosing 'Reference:Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' because AssemblyVersion '15.1.0.0' is greater than '4.0.0.0'. [c:\agent\_work\8\s\src\SampleProject\src\DotNetFullFrameworkApplication.csproj]
2019-03-06T07:11:21.1974031Z C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Reference:System.IO.Compression' and 'Platform:System.IO.Compression.dll'.  NETSDK1033: Choosing 'Reference:System.IO.Compression' because AssemblyVersion '4.2.0.0' is greater than '4.0.0.0'. [c:\agent\_work\8\s\src\SampleProject\src\DotNetFullFrameworkApplication.csproj]
2019-03-06T07:11:21.1974031Z C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Reference:System.Net.Http' and 'Platform:System.Net.Http.dll'.  NETSDK1033: Choosing 'Reference:System.Net.Http' because AssemblyVersion '4.2.0.0' is greater than '4.0.0.0'. [c:\agent\_work\8\s\src\SampleProject\src\DotNetFullFrameworkApplication.csproj]
2019-03-06T07:11:21.1974031Z C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Reference:System.Collections' and 'Platform:System.Collections.dll'.  NETSDK1033: Choosing 'Reference:System.Collections' because AssemblyVersion '4.0.11.0' is greater than '4.0.10.0'. [c:\agent\_work\8\s\src\SampleProject\src\DotNetFullFrameworkApplication.csproj]

Also getting this error building in DotNet Standard targeting 4.6.2.
Despite searching, I have not been able to find any good quality resources about analysing and troubleshooting packages and dependencies. Does the team know of any good resources?

For example, I had an issue with Newtonsoft.Json in a 5-project solution, because one of my projects targeted 12.0.0, and while none of the other projects had this Nuget package installed, Newtonsoft.Json 11.0.0 was clearly a dependency of some package present in the other projects, and I ended up with DLL binding problems running the application on the production server (although not in dev).
At the moment, the solution is to randomly try downgrading likely candidates until the problem goes away.

If we're not going to get clear error messages about how to fix these things, there must be some systematic and clear way to work out how the conflicts are arising.

Any news on this? The bug is open for almost two years... I am also struggling with megabytes worth of useless log entries.

I'm getting this in a project that's targeting 4.7.2 and has netstandard reference

Encountered conflict between 'Reference:System.Runtime' and 'Platform:System.Runtime.dll'. Choosing 'Platform:System.Runtime.dll' because AssemblyVersion '4.1.2.0' is greater than '4.1.0.0'. (TaskId:107)
Encountered conflict between 'Reference:System.Net.Http' and 'Platform:System.Net.Http.dll'. Could not determine a winner because 'Platform:System.Net.Http.dll' has no file version. (TaskId:107)

For some reason this leads to copying reference assemblies (no code in them, metadata only) to the output, and when the exe is started it fails with BadImageException, saying reference assemblies can't be loaded at runtime

Was this page helpful?
0 / 5 - 0 ratings