AaronPowell.MSBuild.Tasks v0.2

Saturday, Aug 9, 2008 2 minute read Tags: MSBuild
Hey, thanks for the interest in this post, but just letting you know that it is over 3 years old, so the content in here may not be accurate.

Ok, well it's actually v0.2.3143.41238 but who's counting :stuck_out_tongue:

So I've got a new version of my MSBuild tasks ready, and in this new minor release I added a new namespace and two new tasks. The new namespace is AaronPowell.MSBuild.Tasks.Sql and the new tasks are DatabaseBackup and DatabaseRestore.
I'm sure you're smart enough to work out what these two tasks do, but for those who are a little slow to catch on.


This task is designed to make it easier to backup a database as part of a build. It generates a Sql command, adds the appropriate parameters and then runs it nicely.
You can specify any location and filename to backup to, provided the Sql Server is able to connect to it to run the backup.

Note - it only supports MS SQL servers and full database backups.


The above shows how to use the MSBuild task in use.


This task is designed to restore a database from a backup, it is slightly more advanced as it requires a few more parameters, such as where to find the log and data files of the database (full path on the Sql server).


With the above example there are two parameters left out, if the name within the data/ log files within the backup these can be provided within the DataName and LogName properties.


So there we go, two pretty new tasks. Get v0.2.3143.41238 now!