artvolk
artvolk

Reputation: 9528

Simple automation of building ASP.NET MVC 2 application

Good day!

I'm looking for solution for perform such task from command-line:

I'm using Visual Web Developer 2010, my project already have Web.Release.config and Web.Debug.config.

Can this be done using MSBuild?

Thank in advance!

Upvotes: 2

Views: 421

Answers (3)

jonezy
jonezy

Reputation: 1923

I typically roll my own using ruby + rake. The following takes care of most of what you have listed.

require 'rake/clean'

SELF_PATH = File.dirname(__FILE__)
PATH_TO_ROOT = SELF_PATH
PATH_TO_WEB = "C:\\Dev\\"
PATH_TO_MSBUILD = "C:\\Windows\\Microsoft.NET\\Framework\\v3.5\\msbuild.exe"

CLEAN.exclude("**/core")
CLEAN.include("*.cache", "*.xml", "*.suo", "**/obj", "**/bin", "../Deploy")

task :build do 
  sh "#{PATH_TO_MSBUILD} /v:q #{PATH_TO_ROOT}/HUD.sln"
end

namespace "deploy" do
  desc "Preps the project for deployment"
  task :package, :project_name do |t, args|
    begin
      Rake::Task["clean"].invoke
      Rake::Task["build"].invoke
      Dir.mkdir("../Deploy")
      sh "xcopy .\\#{args.project_name} ..\\Deploy\\#{args.project_name}\\ /S /C /F /Y /exclude:e.txt"
      begin
        sh "xcopy .\\#{args.project_name}\\Web.config.prod ..\\Deploy\\#{args.project_name}\\Web.config /S /C /F /Y" 
      rescue
      end
    rescue Exception=>e
      puts e
    end
  end
end

Upvotes: 1

B Z
B Z

Reputation: 9463

Yes, you should be able to use MSBuild to do most if not all of the tasks. Check out the MSBuild Community Tasks, they add quite a bit of functionality.

http://msbuildtasks.tigris.org/

HTH

Upvotes: 1

rcravens
rcravens

Reputation: 8388

I don't believe MSBuild itself will do many of the things on your list. You could create a bunch of scripts to do this. However, I recommend taking a look at Hudson continuous integration server. It already can do many of the things on your list. It is a plug-in based system, so if a plug-in does not exist, you can roll your own. In addition there is a fairly active community so you will find many blog posts. Here is the link to their site:

http://hudson-ci.org/

I also did a blog post about getting started with hudson and .net. You may find that useful also:

http://blog.bobcravens.com/2010/03/getting-started-with-ci-using-hudson-for-your-net-projects/

Hope this helps.

Bob

Upvotes: 1

Related Questions