views:

558

answers:

4

I am currently writing a deployment script in MSBUILD, and after downloading several extensions, I have found myself looking at the build file and thinking:

What was the point in doing this in MSBUILD?

This deployment script is completely procedural: stop website, delete folder, copy files, change permissions, start website, etc. There is no fancy dependency stuff which I assume is the natural domain of tools like MSBUILD, NANT and MAKE.

The only reason I can see to use MSBUILD is that it comes as standard, and its easy to put the extensions into your SVN so builds 'just work'.

The problem with it is I have to spend all this time working out how to do 'basic stuff' in MSBUILD (locating extensions, working out syntax) which would be trivial (although more verbose) in Powershell or even command line.

So to sum up: Are procedural tasks suited to MSBUILD or are you better of using something like Powershell?

+3  A: 

It really depends on your situation. If it were up to me, though, and you were using Visual Studio - I would say yes, stay with MSBuild for the sake of integration.

On the other hand, I would choose MSBUILD, as while the tasks are very procedural, it gives you the flexibility to extend this build process later on to handle more complex tasks.

Fritz H
Wouldn't using something like Powershell given me even more flexibility to extend the process?
Schneider
+7  A: 

Check out PSAKE and see what you think.

http://www.jameskovacs.com/blog/IntroducingPsake.aspx http://powerscripting.wordpress.com/2009/01/25/episode-56-james-kovacs-talks-about-psake/ http://code.google.com/p/psake/

Experiment! Enjoy! Engage!

Jeffrey Snover [MSFT] Windows Management Partner Architect

Jeffrey Snover - MSFT
+4  A: 

MSBuild is not a scripting language and shouldn't be used as such. It's almost unfortunate that MSBuild has such a rich extensibility and is flexible enough to be used for just about anything. Use the tools that are most appropriate to the task, if you find yourself spending too much time creating functionality that is too limited and too low quality compared to what you'd be able to create with other technology, you should switch.

Wedge
ill mark this as the answer as its along the same conclusion I came to: use MSBUILD for building sln/proj, but dont fall into the trap of using MSBUILD extensions for everything... mostly pointless
Schneider
+1  A: 

msbuild comes with .NET. You have to add powershell to servers / users must add it - at least through Windows XP, server 2003. That may or may not be a problem in your environment.

I don't think procedural tasks are suited for writing in MSBUILD, simply because the shorter the msbuild, the better as far as I am concerned. I might use msbuild to call them, but would probably write an extension library to implement them.

Precipitous