4
votes

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?

2
Using a custom build system is never not a big mistake. You are using incorrect reference assemblies, not the ones supplied by a targeting pack and stored in c:\program files (x86)\reference assemblies. Probably the ones in c:\windows\microsoft.net. That can cause a lot of additional misery, but you'll probably avoid it. since machines are kept up to date with Windows Update. Avoiding a VS license is penny wise but three pounds of flesh foolish. It is just a warning, keep moving.Hans Passant

2 Answers

8
votes

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.

0
votes

After transferring the old project with code to a new computer (Windows 10, 64-bit, VS2012), I received a similar warning. I was installed NET Framework 4.5(or any relevant for you) and select it in 'Target framework' in properties of project. The warning has been removed!