Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Processor architecture mismatch between projects when building C# MVC 5 site

The error I'm getting is as below...

build 20-Apr-2017 13:23:38 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "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. [D:_atlassian-home\bamboo-home\xml-data\build-dir\blah\blah\blah.csproj]

I've seen other people have the same issue, but after following their solutions, it did not improve my situation (Processor architecture mismatch building error).

This is happening on our CI server (Bamboo) when running MSBuild on the solution.

I'm quite stumped, does anyone have any ideas?

like image 507
Geesh_SO Avatar asked Jan 04 '23 03:01

Geesh_SO


1 Answers

First, it really is just a warning. It should not hurt anything if you are just dealing with Amd64 dependencies. If the configuration is set to any CPU, when one of the assemblies is compiled for Amd64, which implies that it will no longer work on any CPU - it'll work only on 64 bit CPU.

Because you have an Amd64 dependency, technically your project is therefore not "Any CPU" compatible. To make the warning go away, you should actually change your project from "Any CPU" to "x64".

If you still want to configure your project with "Any CPU", you canedit your project file and add this property group and setting to disable the warning:

<PropertyGroup><ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch></PropertyGroup>

Hope this can help you.

like image 183
Leo Liu-MSFT Avatar answered Jan 14 '23 02:01

Leo Liu-MSFT