Pages

Sunday, October 2, 2011

Compile Soultion/Projects by Batch Files

So this time i am writing abt compiling Solutions Or pRoject with the help of Batch File .  That  will really helpfull when you have multiple solutions and having dependency on it .You dont need to open each solution and build it . one by one . Just take Latest/Update with your source control and build it with the crssponding batch file that you have created. If you want to do more you can make a separate batch file to build all batch file one by one . So it is not a very big deal to doing this ..

I have put the one template for a one solution you just Replace You data ( which are in CAPITAL LETTERS) and try the same .After builing you will get the log file in BUildLlog Folder ( it will be created when you are build your soultion)
@echo off

set Configuration="debug"

set MSBuildPath=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\



set dir1="%CD%\(PATH OF PROJECT 1).csproj"
set dir2="%CD%\(PATH OF PROJECT 2).csproj"
set dir3="%CD%\(PATH OF PROJECT 3).csproj"  
set dir4="%CD%\(PATH OF PROJECT 4).csproj"
set dir5="%CD%\(PATH OF PROJECT 5).csproj"  

ECHO Building (PUT THE PROJECT/SOLUTION/NAMESPACE FOR REFRENCE(it will show in the screen) )


%MSBuildPath%MSBuild /logger:FileLogger,c:\windows\Microsoft.Net\Framework\v2.0.50727\Microsoft.Build.Engine.Dll;LogFile="BuildLogs\PROJECT_NAME.txt" %dir1% /p:Configuration=%Configuration%
%MSBuildPath%MSBuild /logger:FileLogger,c:\windows\Microsoft.Net\Framework\v2.0.50727\Microsoft.Build.Engine.Dll;LogFile="BuildLogs\PROJECT_NAME.txt";Append %dir2% /p:Configuration=%Configuration%
%MSBuildPath%MSBuild /logger:FileLogger,c:\windows\Microsoft.Net\Framework\v2.0.50727\Microsoft.Build.Engine.Dll;LogFile="BuildLogs\PROJECT_NAME.txt";Append %dir3% /p:Configuration=%Configuration%
%MSBuildPath%MSBuild /logger:FileLogger,c:\windows\Microsoft.Net\Framework\v2.0.50727\Microsoft.Build.Engine.Dll;LogFile="BuildLogs\PROJECT_NAME.txt";Append %dir4% /p:Configuration=%Configuration%
%MSBuildPath%MSBuild /logger:FileLogger,c:\windows\Microsoft.Net\Framework\v2.0.50727\Microsoft.Build.Engine.Dll;LogFile="BuildLogs\PROJECT_NAME.txt";Append %dir5% /p:Configuration=%Configuration%

ECHO (PUT THE PROJECT/SOLUTION/NAMESPACE FOR REFRENCE(it will show in the screen) ) Completes
pause

1 comment:


  1. I really appreciate you for all the valuable information that you are providing us through your blog.
    Dot Net Training in Velachery

    ReplyDelete