Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I set asp.net mvc 4 project to be x64

Tags:

asp.net-mvc

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.

like image 207
R Swasey Avatar asked Sep 19 '13 10:09

R Swasey


People also ask

How do I change from x86 to x64 in Visual Studio?

To configure a project to target a different platform On the menu bar, choose Build > Configuration Manager. In the Active solution platform list, choose a platform for the solution to target, and then choose the Close button.

How do I create a 64-bit project in Visual Studio?

Choose the Configuration Manager button to open the Configuration Manager dialog box. In the Active Solution Platform drop-down list, select the <New...> option to open the New Solution Platform dialog box. In the Type or select the new platform drop-down list, select a 64-bit target platform.

How do I run Visual Studio in 64-bit mode?

From the Visual Studio menu, choose Test, then choose Settings, and then choose Processor Architecture. Choose x64 to run the tests as a 64-bit process.

Is ASP NET MVC discontinued?

ASP.NET MVC is no longer in active development. The last version update was in November 2018. Despite this, a lot of projects are using ASP.NET MVC for web solution development. As to JetBrains' research, 42% of software developers were using the framework in 2020.


1 Answers

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.

like image 99
BrianLegg Avatar answered Nov 23 '22 17:11

BrianLegg