Skip to content

MSB3277 When referencing a framework assembly with newer build or servicing version #12780

@ericstj

Description

@ericstj

Issue Description

See dotnet/maintenance-packages#243

.NET Framework assembly unification will ignore the last two digits for any assembly in the unification table. So even though the version from the package for previous framework is higher in build or servicing, the runtime will ignore that and still load the version from the GAC.

Ideally RAR would have this same behavior for .NETFramework assemblies in the targeting pack.

Steps to Reproduce

bclMem.zip

Build attached

Expected Behavior

No warnings

Actual Behavior

Warn

    C:\Program Files\dotnet\sdk\10.0.100-rtm.25476.104\Microsoft.Common.CurrentVersion.targets(2437,5): warning MSB3277:
      Found conflicts between different versions of "System.ValueTuple" that could not be resolved.
      There was a conflict between "System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" and "System.ValueTuple, Version=4.0.5.0, Culture=neutral, Pu
      blicKeyToken=cc7b13ffcd2ddd51".
          "System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was chosen because it was primary and "System.ValueTuple, Version=4.0.5.0, Culture=ne
      utral, PublicKeyToken=cc7b13ffcd2ddd51" was not.
          References which depend on "System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
      mework\.NETFramework\v4.7.2\Facades\System.ValueTuple.dll].
              C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.ValueTuple.dll
                Project file item includes which caused reference "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.ValueTuple.dll"
      .
                  System.ValueTuple
          References which depend on or have been unified to "System.ValueTuple, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [].
              C:\Users\ericstj\.nuget\packages\microsoft.bcl.memory\10.0.0\lib\net462\Microsoft.Bcl.Memory.dll
                Project file item includes which caused reference "C:\Users\ericstj\.nuget\packages\microsoft.bcl.memory\10.0.0\lib\net462\Microsoft.Bcl.Memory.dll".
                  C:\Users\ericstj\.nuget\packages\microsoft.bcl.memory\10.0.0\lib\net462\Microsoft.Bcl.Memory.dll

Analysis

I found that specifying SpecificVersion="True" will workaround this (perhaps unintentionally, since that seems to be the opposite of what I would expect) but it seems better if RAR would behave in the same way as the .NET Framework runtime.

Versions & Configurations

Dotnet 10 SDK. Project targeting net472 referencing Microsoft.BCL.Memory 10.0.0.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions