Reputation: 307
I have a VS2012 solution that can be simplified as follows: An asp.net mvc 4 web app, a middle c# class library project, and an end c# library project for calculations etc.
The web app currently has no references to the other projects and is configured to 'Any CPU' when building. The end project is x64. I now want to join the web app to the end project via the middle project, but I understandable get architecture type errors when trying to reference the middle x64 project from the web app. If I set the web app to x64 I also get the same type of error.
The web app will run on and x64 server and so I think the easiest thing to do would be to set the web app to x64 but I believe it might be case that you cannot retrospectively change it i.e. it needs to be created as x64.
My question is Can I convert the existing web app to x64? If not, how do I create a x64 web app (I could not see any option) EDIT: Even when I set up a new mvc 4 project, change the build setting to x64 I still get this problem.
You'll be surprised to hear that I am very new to software development, and although build errors between x86 and x64 seem intuitive I don't really understand why. There are many posts it seems on this topic with answers being 'change all projects to Any Cpu, but I am constrained to keeping the end project as x64.
I'm using Windows 8 and IIS 8.
For reference, the build warning I get when adding a reference for the middle project to the web app is:
Warning 1 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference C:\MyPath\Sln\MiddleProject\bin\x64\Debug\MiddleProject.dll", "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.
Upvotes: 8
Views: 3927
Reputation: 19
Right click on "Project -> Properties -> Build" and change the platform target to the architecture you want.
Upvotes: 0
Reputation: 1700
It took me a lot of digging on this same problem to find the answer. It turns out you need to get IIS Express to run as a 64 bit process. How do you do that?
Change this in VS: Tools | Options | Projects and Solutions | Web Projects | Use the 64 bit version of IIS Express
I hope that helps resolve your issue.
Upvotes: 32