Publishing A Web Project With MSBuild

2009-12-27 00:00:00 -0800

Today’s tidbit of awesomeness comes to you from Glenn Goodrich . He originally posted this information over at the Google Group . I added a little formatting, but the content of the ‘publishing a web project’ section is entirely Glenn’s.

Publishing A Web Project With MSBuild, via Glenn Goodrich

I thought this was pretty cool and didn’t it referenced in the group or on the wiki, so I thought I’d share.

I have a VS.NET solution that has several projects, one of which is a web project (WCF service, actually). I wanted to mimic the “Publish…” option from inside VS.NET in my rake build, and it was trivially easy to do so.

The rake task looks like:

desc "Publish the web site"
msbuildtask :publish do |msb|
  msb.properties = {:configuration=>:Release}
  msb.targets [:ResolveReferences,:_CopyWebApplication]
  msb.properties = {
  :webprojectoutputdir=>"c:/temp/outputdir/",
  :outdir => "c:/temp/outputdir/bin/"
  }
  msb.solution = ".<path to project dir>/Project.Web.csproj"
end

I haven’t tried to publish over http, yet. My guess is if someone wants to go that way, they’d fire up the Web Deployment Tool (something I may look at soon)

Thanks to the following post for helping me get there Publishing Web Applications with MsBuild

And thanks to this group for making Albacore.

Hope someone finds this useful,
Glenn

Alternative Methods Of Publishing

In case you are not interested in this method of publishing, there are some other alternatives

and coming up in the .9 release, will have a plink.exe task courtesy of Hibri Marzook

blog comments powered by Disqus