Created
March 20, 2011 20:46
-
-
Save codeprogression/878660 to your computer and use it in GitHub Desktop.
basic rakefile for building and deploying an asp.net web application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'erb' | |
require 'fileutils' | |
require 'find' | |
require 'rake' | |
require 'rake/tasklib' | |
task :default do | |
package_location="sample/" # website folder location relative to checkout root | |
project_file = "sample/sample.csproj" # website project location relative to checkout root | |
package_name = "website" | |
package = "website.deploy.cmd" | |
destination_site = 'Default Web Site/sample' # Change to match IIS path | |
clr_version = 'v4.0.30319' | |
framework_dir = File.join(ENV['windir'].dup, 'Microsoft.NET', 'Framework', clr_version) | |
msbuild_file = File.join(framework_dir, 'msbuild.exe') | |
FileUtils.remove_file("#{package_location}#{package}", true) | |
FileUtils.remove_file("#{package_location}#{package_name}.zip", true) | |
FileUtils.remove_file("#{package_location}#{package_name}.deploy-readme.txt", true) | |
FileUtils.remove_file("#{package_location}#{package_name}.SetParameters.xml", true) | |
FileUtils.remove_file("#{package_location}#{package_name}.SourceManifest.xml", true) | |
# Package website (requires VS2010 version of msbuild) | |
sh "#{msbuild_file} \"#{project_file}\" /maxcpucount /nr:true /v:m /T:Clean,Package /P:BuildInParallel=true;WarningLevel=0;Configuration=debug;DeployIisAppPath=\"#{destination_site}\";PackageLocation=#{package_name}.zip" | |
# Deploy website (requires Web Deployment service running on web server) | |
sh "#{package_location}#{package} /M:localhost /Y \"-skip:objectName=dirPath,skipAction=Delete,absolutePath=logs\"" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample code for blog post: http://elegantcode.com/2011/03/20/mimicking-the-appharbor-deployment-experience/