Some situations we need to
build dot net projects without installing visual studio in particular servers.
To help such situations, we can use msbuild.exe. Following sections will explain
using BAT file, how we can build the project.
1.0 set dot net framework
path to environment variable.
To enable msbuild.exe in
Command Prompt, you simply have to add .net framework path in the environment variable of the machine.
You can access the
environment variables by right clicking on 'Computer', click 'properties' and
click 'Advanced system settings' on the left navigation bar. On the next dialog
bog click 'Environment variables,' scroll down to 'PATH' and edit it to include
your path to the framework (don't forget a ';' after the last entry in here.
For
reference my path was C:\Windows\Microsoft.NET\Framework\v4.0.30319.
2.0
Bat file code
Open a note pad. Copy and
paste below code and save extension as bat. Ex deploy.bat
Under bat file code ,you need to give dot net
project’s solution file path or project file path after ‘msbuild.exe’ depend on
the requirement as below.
‘pathMSBuild’ is denote dot
net framework path
Code :
set pathMSBuild =
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\"
@echo off
cls
cd %pathMSBuild%
msbuild.exe "D:\Netstarter -projects test R and
D\NIGEL\nigel\codePool\NigelSolution\NigelSolution.sln" /p:configuration=debug
pause
3.0 Every time you click BAT file , project will build in
particular server location.