Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Visual Studio to create 32-bit and 64-bit configurations

I'm currently trying to configure Visual Studio to automatically set up the appropriate configurations for 32-bit and 64-bit compilation.

Ideally, I'd like to be able to have Visual Studio automatically show x64 as a platform under the Configuration Manager.

How can I configure VS so any new project I create has this?

Thanks!

like image 387
Mike Bailey Avatar asked Jan 26 '11 22:01

Mike Bailey


People also ask

How do I change my Visual Studio for 32-bit to 64-bit?

From the BUILD menu in Visual Studio, select Configuration Manager. From the Active solution platform drop-down list, select New. The New Solution Platform dialog displays. In the Type or select new platform combination box, select x64.

Is Visual Studio 32-bit or 64-bit?

Visual Studio enables you to set up your applications to target different platforms, including 64-bit platforms. For more information on 64-bit platform support in Visual Studio, see 64-bit applications. Visual Studio 2022 on Windows is now a 64-bit application.

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

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

How do I create a new configuration in Visual Studio?

In the Configuration drop-down list for that project, choose New. The New Project Configuration dialog box opens. In the Name box, enter a name for the new configuration. To use the property settings from an existing project configuration, in the Copy settings from drop-down list, choose a configuration.


1 Answers

Visual Studio 2010 and 2008 both provide a way to do this.

Project Templates are used by VS to create new projects. These templates can be copied and updated as alternate versions or the originals can even modified in place. You can either use the VS editor to modify the Project Template or you can do it manually; it's your choice:

To use the Visual Studio editor:

  1. Create a new project
  2. Configure the Project and Build Configuration settings the way you'd like to see all future projects of the same type configured. In your case, you'll want to add "x64" to the Configuration Manager, then use it in your project's configurations.
  3. Export the project as a template: File -> Export Template

To dig into the Project Template files yourself:

Project Template files are stored here: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates

An example is the Windows Forms Application project template, which is housed in this ZIP file: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Windows\1033\WindowsApplication.zip

The ZIP file contains a handful of files that form the structure of the project (ie: form1.cs) and contain templatized versions of what you get when you create a project of this type.

The important file you'll want to modify is: windowsapplication.csproj. The name of the file will be different for each template, but the .csproj will remain consistent. It is the templatized project file, so modifying this will modify the project settings for all future projects made from this template.

To modify it, simply extract it from the ZIP, make your changes, then put it back into the ZIP file, overwriting the existing one.

In all cases, the result will be:

Now, when you create a new project of that type in the future, just pick YOUR template instead of the default one and you'll have x64 as a Configuration. You can even share the configuration with your friends since it's stored as a ZIP file.

This MSDN page documents the steps needed for 2010. Click "Other Versions" at the top of that page to see the instructions for VS 2008:

http://msdn.microsoft.com/en-us/library/ms185319(v=VS.100).aspx

like image 116
CobaltBlue Avatar answered Sep 19 '22 13:09

CobaltBlue