Skip to content

.NET Application Remote Web Deploy automation

March 23, 2011

Scope

The aim was to automate Web application remote deployment on Amazon EC2 instance. To achieve it I was using Microsoft Web Deploy IIS extension(this feature included into MS VS 2010). Below the main steps how to do it.

Main steps

1. First of all using powershell I automated Amazon EC2 instance launch where all necessary software were installed and configured according to blog post. Do not forget to add port 8172 to Amazon security and set MS Deploy service to Automatic start.

2. After Amazon EC2 instance successfully started we need to Rebuild & Package our source code to make new Deployment package. Settings according to the following image:

3. Finally we need to deploy our package using the following powershell script:

$pwd = "%password%"
$username = "%username%"
$cmdPath = "%project_path%\obj\Debug\Package\%project_name%.deploy.cmd"

$deployPath = "https://%your_remote_server_address%:8172/MsDeploy.axd"
$command = "$cmdPath /y /M:$deployPath /u:$username /p:$pwd –allowUntrusted /A:basic"

Invoke-Expression $command

After package deployment you can run tests and so on…

Problems you may met…

MSBuild Package issue:

I met this issue when were trying to *Build deployment package* on Cruise Control .NET machine using command line. The error was kind of:

c:\Projects\MySolution\MySolution.sln.metaproj :
error MSB4057: The target "Package" does not exist in the project. [c:\Projects\MySolution\MySolution.sln]

The trick is that: when there is solution with lots of projects we need to specify UI project .csproj file for making “Package”

DB file attachment issue:

There was SQL Server 2005 installed on build machine and error occurred:

dbFileName cannot be opened because it is version 655. This server supports 612 and earlier

To fix it up I need to install SQL Server 2008 express and ms vs 2005 sp 1 to eliminate the problem.

Advertisements

From → Automation

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

%d bloggers like this: