How to create a batch command file to build your Visual Studio Solution


  • Create a batch file ".bat" file under the same directory of your solution and paste the following commands into that file.


net stop w3svc@echo offsetlocalpushd "%~dp0"set MSBUILDEXE=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exeif not exist "%MSBUILDEXE%" (    echo Microsoft Build Engine ^(MSBuild^) 4.0 does not appear to be     echo installed on this machine, which is required to build the     echo solution.    exit /b 1)for %%i in (debug release) do if exist "%MSBUILDEXE%" "%MSBUILDEXE%" MySolutionNameHere.sln /p:Configuration=%%ipopdnet start w3svc


  • Save the file in your solution directory.
  • Replace the "MySolutionNameHere.sln" with your solution name.
  • Run the batch file




Comments

  1. You can also push and deploy your code to the IIS using this script

    echo "******** Deploy your package to a server ******** "
    "C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package=CODE.AP.zip -dest:auto,wmsvc=10.1.150.62,username=[UserName],password=[Password],authType=basic -setparam:name='IIS Web Application Name',value='Default Web Site\YOUR.SITE.API\' -allowUntrusted

    ReplyDelete

Post a Comment

Popular posts from this blog

How can TeamCity generate Release notes from JIRA during a build