Script Build

In normal development, we usually use the IDE to build our project.
We can write powershell script to do this for us, it is really reliable and efficient way to build our project and upload the compile source to the server.

#This script is to build the lastest code
Set-ExecutionPolicy Unrestricted

$src = "D:\SourceCode\Store\";
$projFolder = "$src\WebServices\";

cd $projFolder

$remoteUrl = git config --get remote.origin.url

Write-Host "Git Pull: " $remoteUrl

Start-Sleep 1

$projSolution = "$src\WebServices\Store.sln"
$nugetExePath = "$src\WebServices\.nuget\"

#Redownload all Nuget Package
cd $nugetExePath
.\Nuget.exe restore $projSolution

#Where is the profile
$profile = "D:\SourceCode\Store\WebServices\Presentation\WebServices\Properties\PublishProfiles\Pro.pubxml"
$msBuildPath = "C:\Windows\Microsoft.Net\Framework\v4.0.30319\"
cd $msBuildPath

.\MSBuild.exe $projSolution /p:DeployOnBuild=true /p:PublishProfile=$profile /p:VisualStudioVersion=11.0

Pause
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s