Beginners_Luck
Beginners_Luck

Reputation: 23

use a batch file to execute msbuild project

I'm an intern and have created an msbuild project that builds all of the .csproj files in the repository. Now I have to create a batch file that calls the msbuild.csproj I made and execute it on a daily schedule (say every day at 12:00pm). I don't know how to make a batch file and need some help getting started.

Upvotes: 2

Views: 9946

Answers (1)

granadaCoder
granadaCoder

Reputation: 27842

Place this in a .bat file:

set msBuildDir=%WINDIR%\Microsoft.NET\Framework\v3.5    
REM perhaps you need a different framework? %WINDIR%\Microsoft.NET\Framework\v4.0.30319


call %msBuildDir%\msbuild /target:AllTargetsWrapper "MySolutionOrCsProj.sln" /p:Configuration=Debug;FavoriteFood=Twix /l:FileLogger,Microsoft.Build.Engine;logfile=ZZZZZMSBuildSetupAndBuildAllTargetsWrapper_Debug.log

set msBuildDir=

You'll have to adjust the target name.

Wait, I just remembered I answered this before in more detail. See:

Build Visual Studio project through the command line

Upvotes: 7

Related Questions