views:

80

answers:

3

Hi

I have a solution file comprising of 15 projects using a few third party dll references. I want to be able to build the solution from a batch file. What is the best way to do this?

Thanks

A: 

One way to get started is to open the project in Visual Studio and select Build | Rebuild Solution. Then go to View | Output. In the output window select "Build" in the Show Options From dropdown. This will display the commands that Visual Studio is using to build the project. You can paste those into a batch file, and read or modify them as desired.

If you want to maintain both Debug and Release versions of your application, then you will want to select the correct configuration and then follow the above steps for each version.

Jeffrey L Whitledge
Can someone explain the down vote? Is the information not correct? Does it not address the question asked?
Jeffrey L Whitledge
+7  A: 

Run msbuild - for example:

msbuild MySolution.sln /p:Configuration=Release /p:Platform="Any CPU"
Jon Skeet
Wow ..that was easy..thanks
stackoverflowuser
+5  A: 

One of the simplest ways is to execute msbuild with the solution file as input:

@echo off
call %windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe path\to\solution.sln

If this is done in a Visual Studio command prompt you can skip the path to msbuild.exe.

Fredrik Mörk
+1 thanks Fredrik
stackoverflowuser