msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

SDK 7 does not generate MSB3270 "mismatch between architectures" while SDK 6 does

Open ArturDorochowicz opened this issue 2 years ago • 5 comments

Describe the bug

There's a possible regression in SDK 7 with regard to generating MSB3270 warning (mismatch between the processor architecture of the project being built and the processor architecture of the reference). SDK 7 does not produce the warning while SDK 6 does.

To Reproduce

Using SDK 6:

dotnet new globaljson --sdk-version 6.0.400
dotnet new classlib
dotnet add package Magick.Net-Q8-x64
dotnet build

Produces MSB3270 warning:

MSBuild version 17.3.2+561848881 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\6.0.403\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3270:
 There was a mismatch between the processor architecture of the project being built "MSIL"
 and the processor architecture of the reference
 "[...]\.nuget\packages\magick.net-q8-x64\12.2.1\lib\netstandard21\Magick.NET-Q8-x64.dll", "AMD64".
 This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your
 project through the Configuration Manager so as to align the processor architectures between your project
 and references, or take a dependency on references with a processor architecture that matches the
 targeted processor architecture of your project.
[...]
Build succeeded.
    1 Warning(s)
    0 Error(s)

Same thing with SDK7:

dotnet new globaljson --sdk-version 7.0.101
dotnet new classlib
dotnet add package Magick.Net-Q8-x64
dotnet build

Builds without any warnings:

MSBuild version 17.4.0+18d5aef85 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.

  [...]
 
Build succeeded.
    0 Warning(s)
    0 Error(s)
 
Time Elapsed 00:00:03.05

The Magick.Net-Q8-x64 package contains an x64 assembly (and some native libs as well).

Exceptions (if any)

Further technical details

  • Include the output of dotnet --info
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version

ArturDorochowicz avatar Dec 15 '22 15:12 ArturDorochowicz