views:

397

answers:

4

I'm trying to setup .NET (C#) build from command line. Can someone just give me a list of environment variables that I need to set up in the MSDOS prompt before I can run MSBuild.exe from the command line. The path to MSBuild executable would be the most obvious example. I cannot rely on setting variables from MyComputer->Properties->Advanced->Enviroment Variables so I really need a full list if such list exists

P.S. The build needs to be automated (command line) and I'm not using Visual Studio but building with .NET framework (v3.5) only

A: 

Visual Studio comes with a program that will set all of the required command line variables for you in a command shell. It is recommended that you run that, this will give you cmd in a window that you can compile any of the different languages.

1800 INFORMATION
No can do. I'm using a different ways of setting the environment and I need a list of variables. I guess I need to go and dig up that batch file you mentioned
DroidIn.net
And I'm building with .NET framework only - no VS involved
DroidIn.net
+2  A: 

Can someone just give me a list of environment variables that I need to set up in the MSDOS prompt before I can run MSBuild.exe from the command line.

MSBuild has a set of reserved properties that are used, but you don't need to do anything to set these up. Any variables that MSBuild needs will be setup within MSBuild. The only environmental variables you need to worry about are ones that you yourself require.

The physical path to MSBuild for your dos script is:

C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild

Gavin Miller
A: 

In the Visual Studio installation there is the batch file vsvars32.bat that will set the environment variables. If you want the list then record the full list of environment variables before and after calling it, e.g. in a command line window:

set
"D:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
set

And find the difference between the two lists.

(Your path to vsvars32.bat may vary...)

Peter Mortensen
+1  A: 

You don't need to set any env variables when calling MSBuild. If your build scripts rely on a set of env variables then you will have to set those yourself. As for the default build process no special env variables are required.

Sayed Ibrahim Hashimi