How can I choose between 32-bit or 64-bit build in

2020-05-23 08:37发布

问题:

I'm having a problem when I try to build my solution in C# Express 2008. I need to build it for 32-bit architecture, but it always build for 64-bit. In Visual Studio 2008 I can choose the architecture, but I can't find this option in C# Express.

Is there a way to do this in C# Express?

回答1:

Have a look at what the differences look like in the project file in the full Visual Studio, and hand-craft the same edits to your C# Express project - VS will respect those changes, even if it won't let you make them from within the IDE.

EDIT: As Jeff points out in the comments, if you go to Tools -> Options, tick the "Show all settings" box at the bottom left. Then under "Projects and solutions" tick "Show advanced build configurations". That will let you edit a lot more build options, including the target architecture. You may need to go through the Configuration Manager and create a "New Project Platform" however.

Even when you've done this, bear the first paragraph in mind for other options which simply aren't available within C# Express: it's still using the same build engine (msbuild) underneath, so as long as it isn't using any tooling specific to more powerful versions (e.g. the static checker for Code Contracts, only available for Premium and Ultimate) you should be fine.



回答2:

Look at this question:

How to switch between debug and release in Visual C# 2010 Express?

Following same approch suggested there, you will be able to set architecture for your program in Express editions. The problem it's that,by default some "advanced" options are disabled in Express editions, but you can easyly re-eanble them.



回答3:

I found it. "Tools > Options > Project and Solutions > General > Show advanced build configurations" Thank you all.



回答4:

By default, C# Express hides solution configurations from you. However, you can change this in the Tools->Options dialog so that you can then specify new build configurations and change their platform targets.



回答5:

In the project properties, you should be able to select the "Platform Target" - this can be "Any CPU", "x86", "x64", or "Itanium" for me (in VS2008). Is this selection not available in C# Express?



回答6:

I was getting this error as well, since I was running a 32-bit application on a 64-bit machine. I fixed this by going to the IIS app pool and changed the support 32bit option to true.