0

I have an assembly which I guess is built in x64 and I want to reference that in a project with Any CPU configuration. But When I reference that .net assembly to the prject with Any CPU platform, I get the following warning

warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\QvAdmin\Documents\Visual Studio 2013\Projects\QvAccessPointT2\x64\Debug\CppT1.exe", "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.

So I am trying to use a c++ mixed mode assembly as described here. I created a CLR console app(C++).

enter image description here

But again I get the same exception I was fighting against so long. In the solution shown CSharpT1 is the startup project which references CppT1, a CLR Cpp Console app project. What I expected after reading this is that I would be able to reference CppT1 with bout any problem becuase its a Cpp project and a configuration is set to x64. But the problem remained. My idea is throw Cpp project I would be able to load the x64 assembly. This is one more reference.

Message: An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'CppT1, Version=1.0.5578.39432, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
VivekDev
  • 20,868
  • 27
  • 132
  • 202
  • Why do you want your project to be "any cpu"? I believe you won't be able to run it on x86 if you reference a x64 project, as that cannot run on x86. – wimh Apr 10 '15 at 17:03
  • The name of the Platform is not relevant to C# projects, you need to remove the jitter forcing. Right-click your C# project in the Solution Explorer window, Properties, Build tab. Untick the "Prefer 32-bit" checkbox if you see it, ensure that the Platform target is set to AnyCPU. Repeat for the Release configuration. – Hans Passant Apr 10 '15 at 17:15

0 Answers0