4
votes

I am building a project which is showing a warning:

warning MSB3270: There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "DiagLib, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86", "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.

My project is working fine but I would like to remove this warning.

1
Did you try changing the targeted processor as suggested in your warning message ?Hyarantar
Hi.. Ya the targeted processor is always set to x64 only. I verified that in Configuration Manager. Any way to solve this warning? Please help.. Thanks..yemans
In your warning message, the processorArchitecture is x86. Have you tried changing your targeted processor to x86 ?Hyarantar
I've this also with VS-2017 and compiling a compound C# C++ C project in 32-bits (x86, C-part unmanaged). It is the last warning.. and I cant solve it :( nothing goes wrong, everything runs fine.Goodies
Found it.. I solved the warning by setting the top level program (C#) from target "Any CPU" to target "x86" in Project Properties. This is strange, because Microsoft promises a valid link from "Any CPU" to x86 CPP/CLI wrappers.Goodies

1 Answers

6
votes

See comment above.

The warning occurs for C# parts of your x64 program. It is probably set to "Any CPU" because your application is running fine.

For compound C#/C++ projects, better avoid "Any CPU" in the C# part. Make sure you set "x64" explicitly as Platform Target on all C# components and also "x64" for the current mode of your solution.