Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I load the 64-bit Visual Studio Tools Command Prompt?

My development machine is running Windows 7 Ultimate x64. I installed Visual Studio 2010 Ultimate. When I open the Visual Studio Command Prompt (2010), I get the message

Setting environment for using Microsoft Visual Studio 2010 x86 tools.

I have also setup the PowerShell Community Extensions in my Windows PowerShell user profile. And I use the Invoke-BatchFile cmdlet to install the Visual Studio Tools into all my PowerShell sessions

$vcargs = ?: {$Pscx:Is64BitProcess} {'amd64'} {'x86'}
$vcvars = "${env:VS100COMNTOOLS}..\..\VC\vcvarsall.bat"
Invoke-BatchFile $vcvars $vcargs

My vcargs resolves to amd64. I looked in the vcvarsall.bat file for the location of the x64 batch file and got ~dp0bin\amd64\vcvars64.bat. That directory (and file) does not exist.

How do I get the vcvars64.bat file installed properly?

like image 378
Anthony Mastrean Avatar asked Feb 26 '11 18:02

Anthony Mastrean


People also ask

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.

How do I open the Tools in Visual Studio command prompt?

On the Start screen, press Ctrl+Tab to open the Apps list, and then press V. This brings up a list that includes all installed Visual Studio command prompts.

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

Open the 32-bit project in Visual Studio 2008. In the file menu, click Build and select Configuration Manager. Pull down the drop-down under “Active solution platform” which currently displays “Win32” and select New. In the drop-down for “Type or select the new platform”, select “x64”.

What is x64 native tools command prompt?

x64 Native Tools Command Prompt - Sets the environment to use 64-bit, x64-native tools to build 64-bit, x64-native code. x86_x64 Cross Tools Command Prompt - Sets the environment to use 32-bit, x86-native tools to build 64-bit, x64-native code.


2 Answers

When running in the batch processor, %~dp0 expands to the path where the .bat file is executing. So in the default install for VS2010, that resolves to c:\program files\microsoft visual studio 10.0\vc\bin\amd64\vcvars64.bat. Which is indeed missing, that's a bug they don't seem to be interesting in fixing.

Use "x86_amd64" instead. You'll get the cross compiler, the same one that's used by the IDE.

like image 54
Hans Passant Avatar answered Oct 26 '22 09:10

Hans Passant


Install the x64 Components

The problem is an incomplete installation of Visual Studio. I only installed the C# components. I needed to install, at least, the Visual C++ x64 Compilers and Tools.

Adding Components to an Existing Installation

I had problems adding those components to an existing installation. VS2010, especially with SP1 installed, has a ton of bugs around modifying the installation. I encountered some kind of path not found error

  1. I uninstalled SP1 first. I needed the VS2010 installation media on hand (unpack to a directory, insert the real disc, or mount to a virtual drive).
  2. Then I added the VC++ components to the VS installation
  3. Then I was able to reinstall SP1.
like image 26
Anthony Mastrean Avatar answered Oct 26 '22 11:10

Anthony Mastrean