Feyisayo Sonubi
Feyisayo Sonubi

Reputation: 1072

Can't get setting Visual Studio 2013 Environment Variables to work

I find using the command line to compile my C# sources a lot easier than having to launch resource-intensive VS2013 just to compile one class.

From this link on msdn, all I'm to do is navigate to the right path of my installation in command prompt, to be precise: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools . Then run the .bat file called vsvars32.bat.

Now everything works fine before I close the command prompt window after I run the batch file, I can use the csc compiler now as I don't get the message:

But the minute I close command prompt to launch it again, I'm back at:

'csc' is not recognized as an internal or external command, operable program or batch file.

I thought it could have something to do with launching command prompt with administrative rights so I did that, launched command prompt as an administrator, ran the batch file again, closed command prompt, relaunched and the dreadful message came back.

I really can't say why this happens as I've checked my Environment Variables in Computer > Properties > Advanced System Tools and I have the VS120COMNTOOLS variable there.

Upvotes: 0

Views: 1135

Answers (1)

jessehouwing
jessehouwing

Reputation: 114461

In your start menu you can find a "Developer Command Prompt for VS2013"

enter image description here

By starting that instead of the normal "cmd" it will be configured to use the Visual Studio 2013 command line tools automatically.

All my versions of Visual Studio have always created these, but in case they're missing from your start menu, the shortcut files are stored here:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts

enter image description here

You can pin these to the start menu to make them easy to access if you want to.

The command that underpins the Visual Studio Command prompt is:

cmd.exe /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat""

Where /k starts the command line, then executes the command passed in and then keeps the commandline open.

Upvotes: 2

Related Questions