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.
1 Answer
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:
9 Comments
rud3y
ooc why would he set msBuildDir 2x? it would be overwritten. Did you mean to put an IF EXIST in front?
granadaCoder
He (or she) didn't mention the framework he (or she) is using. You only need one "setter", but I was drawing attention that one has to match up the FW version.
rud3y
Ahh, If you change this to say IF EXIST %WINDIR%\.\.\v3.5 set msBuildDir= etc... do that first, that way it will use the latest version of .NETFW
granadaCoder
Just because one has the latest FW installed, does not mean that is the FW to use to build the .sln file. I have framework 4.5 installed, BUT, most of the time I am using FW 4.0 to build the projects.
granadaCoder
Ok, glad it helped. Don't forget you have the power to mark as "correct answer" and/or upvote the response. Thanks.
|