dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

After migrate warning, "There was a mismatch between the processor architecture of the project being built" appeared #674

Closed srivatsn closed 7 years ago

srivatsn commented 7 years ago

From @MarkMichaelis on January 17, 2017 22:4

After migrating a solution, the following warning appeared: Severity Code Description Project File Line Suppression State Warning MSB3270 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Dropbox\SCC\GIT\IntelliTect.Repo\Coalesce\src\Coalesce.Domain\bin\Debug\net46\Coalesce.Domain.exe", "x86". 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. Coalesce.Domain.Tests C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 1912

Hard coding the projects to x86 resolved the problem - but the project should be AnyCPU.

See the following commit to reproduce the problem: https://github.com/IntelliTect/Coalesce/commit/4358d4821cdf98c6f323ee39ae62669a48124aca

/cc @natidea @jinujoseph @morrisjoe @granterickson @breaman @ascott18

Copied from original issue: dotnet/roslyn-project-system#1225

rainersigwald commented 7 years ago

If the warning is accurately describing the state of the world, MSBuild does provide an escape hatch: the property

<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>

But if the issue is that the .exe is x86 instead of MSIL, then this would be silencing a useful warning.

nguerrera commented 7 years ago

Closing as duplicate of #396, the plan for which will fix this.