I'm new to project configuration in Visual Studio 2010, but I've done some research and still can't quite figure this issue out. I have a Visual Studio solution with a C++ DLL referencing the C# DLL. The C# DLL references a few other DLLs, some within my project and some external. When I try to compile the C++ DLL, I get this warning:
warning MSB3270: There was a mismatch between the processor architecture of the project being build "MSIL" and the processor architecture of the reference "[internal C# dll]", "x86".
It tells me to go to Configuration Manager to align my architectures. The C# DLL is set up with platform target x86. If I try to change this to something else, like Any CPU, it complains because one of the external DLLs it depends on has platform target x86.
When I look at Configuration Manager it shows the Platform for my C# DLL as x86 and for my C++ project as Win32. This seems like the right setup; surely I don't want the project for my C++ project to have platform set to x64, which is the only other option presented.
What am I doing wrong here?
I had this problem today and just looking the building configurations in Visual Studio wasn't helping because it showed Any CPU for both the project that wasn't building and the referenced project.
I then looked in the csproj of the referenced project and found this:
Somehow this PlatformTarget got added in the middle of a config change and the IDE didn't seem to see it.
Removing this line from the referenced project solved my problem.
I had the same problem with SQLite opening connection, and using the Nuget and installing the component used in project (SQLite) fixed it! try installing your component this way and check the result
I had a very similar warning in my build. My projects were set to target .NET 4.5, on the build server the Windows 8.1 SDK (for .NET 4.5.1) was installed. After updating my projects to target .NET 4.5.1 (wasn't a problem for me, was for a completely new application), I didn't receive the warning anymore...
I solved this warning changing "Configuration Manager" to Release (Mixed Plataform).
If your C# DLL has x86-based dependencies, then your DLL itself is going to have to be x86. I don't really see a way around that. VS complains about changing it to (for example) x64 because a 64-bit executable can't load 32-bit libraries.
I'm a little confused about the configuration of the C++ project. The warning message that was provided for the build suggests that it was targeted for AnyCPU, because it reported the platform that it targeted was [MSIL], but you indicated that the configuration for the project was actually Win32. A native Win32 app shouldn't involve the MSIL - although it would likely need to have CLR support enabled if it is interacting with a C# library. So I think there are a few gaps on the information side.
Could I respectfully ask you review and post a bit more detail of the exact configuration of the projects and how they are inter-related? Be glad to help further if possible.
This is a very stubborn warning and while it is a valid warning there are some cases where it cannot be resolved due to use of 3rd party components and other reasons. I have a similar issue except that the warning is because my projects platform is AnyCPU and I'm referencing an MS library built for AMD64. This is in Visual Studio 2010 by the way, and appears to be introduced by installing the VS2012 and .Net 4.5.
Since I can't change the MS library I'm referencing, and since I know that my target deployment environment will only ever be 64-bit, I can safely ignore this issue.
What about the warning? Microsoft posted in response to a Connect report that one option is to disable that warning. You should only do this is you're very aware of your solution architecture and you fully understand your deployment target and know that it's not really an issue outside the development environment.
You can edit your project file and add this property group and setting to disable the warning: