MSBuild example

MyBuilder.csproj

<?xml version="1.0" encoding="utf-8"?>
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0" DefaultTargets="Deployment">

<PropertyGroup>
<OutputDir>c:\Output</OutputDir>
</PropertyGroup>

<ItemGroup>
<ProjToBuild Include="MyProj.sln">
<Properties>OutputPath=$(OutputDir);Configuration=Release</Properties>
</ProjToBuild>
</ItemGroup>

<Target Name="Deployment">
<MSBuild Projects="@(ProjToBuild)"/>
</Target>

</Project>

MyBuilder.bat

call "C:\Program Files\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
msbuild MyBuilder.csproj
pause

Automatic deployment

For automatic deployment my projects I created two scripts: copy_proj.bat and deploy.bat as follows:

copy_proj.bat

@echo off

::preparing timestamp based on current date for backup directory name
set TIMESTAMP=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%

::application root
set DESTPATHPREFIX=C:\Apps

::backup root
set BACKUPPREFIX=C:\Backup

::source directory with project
set PROJDIR=%1

::destination folder's tree
set DESTTREE=%2
 
set BACKUPPATH=%BACKUPPREFIX%\%DESTTREE%\%TIMESTAMP%
set DESTPATH=%DESTPATHPREFIX%\%DESTTREE%

::coping current application version to backup directory
robocopy %DESTPATH% %BACKUPPATH% /e /log+:%PROJDIR%_%TIMESTAMP%.txt

::coping new application version to destination folder
robocopy %PROJDIR% %DESTPATH% /e /purge /log+:%PROJDIR%_%TIMESTAMP%.txt

deploy.bat

@echo off

call copy_proj.bat Slanto.Tools.DocumentService Tools\Slanto.Tools.DocumentService

pause

To deploy your applications there is a need to put all built projects in one directory and run deploy.bat script