Domanda

This tutorial shows how to Define a Custom Workflow to Deploy a Database from Team Foundation Build: http://msdn.microsoft.com/en-us/library/ff805001.aspx

However, when TFS tries to deploy my database, it complains that I must specify a connection string. I provided the .deploymanifest file as a command line parameter, and the .deploymanifest file has the connection string.

Why is VSDBCMD complaining that I haven't entered a connection string? It is also complaining about unresolved references, which are also contained in the .deploymanifest file.

Below is the top few lines of my .deploymanifest file:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <TargetConnectionString>Data Source=SQL2K8DEV;Integrated Security=True;Pooling=False</TargetConnectionString>
        <TargetDatabase>Super_DB</TargetDatabase>
        <DeployToDatabase>True</DeployToDatabase>
        <DeployToScript>True</DeployToScript>
.
.
.

EDIT: The .deploymanifest file snippet above is not correct. I took that snippet from the .deploymanifest file generated by my local build, not the TFS build. The .deploymanifest generated by the TFS build was incorrect, which led me to investigate the configuration being used, which ultimately solved my problem (see answer below).

And here are the errors I am getting from VSDBCMD:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy\VSDBCMD.EXE /a:Deploy /dd+ /dsp:Sql /manifest:RTS.deploymanifest

Before you can deploy a database, you must specify a connection string in the project properties or at a command prompt.

TSD\\TXDASQL2K8DEV\RTS_Deploy\DEV_Nightly_build\RTS Development Nightly Build\RTS Development Nightly Build_20111202.7\RTS.dbschema (380,7)
 - The reference to external elements from the source named 'Master.dbschema' could not be resolved, because no such source is loaded.
È stato utile?

Soluzione 2

Turns out that the build was using the Release configuration, and I had only setup the Debug configuration to deploy to the DB. Ugh. Once I updated the Release configuration, it worked just fine.

My original question was misleading, since I took the first few lines from my locally built .deploymanifest instead of the .deploymanifest generated by the TFS build. Shame on me...

Altri suggerimenti

Not 100% on this, but I've used the same process (this) to deploy databases to our internal SQL Server boxes in automated builds, you can set the connection string using an Argument in the workflow designer quite easily.

So if you create a new Argument in the designer** called DBServer (for example) in the Invoke VSDBCMD task you can add " /cs:Data Source=" + DBServer + ";Integrated Security=True;Pooling=False"

Actually worth playing about with this as you can parametise your whole VSDBCMD (such as the manifest name) to make a generic database build/deploy which can then be used for other builds you may have (if you havent already).

** you can also edit the way it appears and give it useful name/description in the Build Definition using the Metadata property in the Arguments list.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top