5

Can anyone shed some light on how to get Team Build 2010 beta 2 to push a SQL database project to the SQL server?

In VSTS 2008 you'd just add MSBuild commands with the targets attribute set to "deploy" in the TFSBuild.proj file, but I'm having a little trouble translating that to the new workflow based xaml thing that 2010 uses.

What I'm looking for is how to trigger the actual deployment of the databases themselves. It is already generating the deployment scripts just fine.

4 Answers 4

6

For anyone still looking for the answer, use an Invoke Process that uses vsdbcmd.exe: http://msdn.microsoft.com/en-us/library/ff805001.aspx

Sign up to request clarification or add additional context in comments.

6 Comments

Thank you so much for that answer! I'd missed that article, and never had really solved this problem.
Is it just me or is this almost impossible when doing a nightly build?
To be honest, I gave up on using team build to deploy the DBs. I've instead switched everything for our nightly over to use a SQL Express file attached reference database that we just maintain as part of our development process; when we check in DB project stuff, we just make sure to use schema compare to write the changes to the reference DB. This way we can use the DB projects, assure ourselves that they do "build" nightly, yet not have to muck about with the DB project deployment.
I am curious to know what problems you guys encountered. I don't see why this could not be use for nightly builds.
For me the problem is that we're a small shop with only 4 developers on staff. Getting Team Build setup, looking after it, then figuring out how to get the DB projects stuff to build was just too much effort. After wasting two days time messing about with it, I just cut my losses and moved on to something that worked and was intuative to use. I feel that way about 90% of team system after using it. It's nice, but honestly, just too much effort to manage and setup for a small shop... never mind the retarded licensing costs.
|
1

Here is an example:

http://www.nablasoft.com/alkampfer/index.php/2009/10/06/deploy-a-database-project-with-tfs-build/

It may be that you are simply missing the DeployToDatabase=true

2 Comments

Yes, that is exactly how you do it... in VS 2008 using team build 2008. What I need is info on how to do the same in tfs 2010, which is now using a xaml based windows workflow file to control the build process.
I had to edit the XAML (in MS's horrendously slow visual XAML editor!) to add "/t:Build,Deploy" to the msbuild arguments.
1

There is another solution to this problem if you don't need incremental database upgrade. So if recreating the database for each build is ok with you the following would also work.

Add a deploy target to Database Project file

Configure the deployment settings for ‘My project settings’. Those settings will then be used by the build server when building the solution. When building locally, the settings used will be the ones from ‘My isolated development environment’.

  1. In the database project properties

Deploy Action needs to be ‘Create a deployment script (.sql) and deploy the database’; this will prevent the execution of the script, it will only create it.

  1. Database project file

Modify the database project file (right-click database project, select Unload, right-click again, select Edit [ProjectName].dbproj) from

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

To

<Project DefaultTargets="Build;Deploy" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

When the Build server builds the solution containing the database project, adding the default targets will also deploy the database. This build will use the Deploy settings selected for ‘My project settings’.

Pros

  • Easy to set up

Cons

  • Because the default target is changed to Build and Deploy, when a developer do a local Rebuild of the solution, it will also deploy the database (building only won't trigger the deployment)

Comments

0

The closest thing I've found so far is this post from Jim Lamb (the Team Foundation PM at Microsoft).

Here he talks vaguely about creating a custom proj file and modifying the default build process template to invoke the proj file.

He also talks about using the upgrade template, which I'd previously ignored. Apparently the upgrade template can be used to invoke a 2008 build definition. I'd rather not invoke and define the entire build based on the legacy proj file though, but at least it is an option.

Neither topic contains sufficient information for me to actually make the modifications necessary, but it does give me a reasonable starting point for some future experimentation.

2 Comments

I have the same problem. Ever get an answer?
Nope. Never did find the answer. I've put off an upgrade until 2010 goes RTM. Hopefully the release will either have more features for deployments or at least some more documentation and instructions for customizing the workflow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.