B Z
B Z

Reputation: 9463

Using PublishProfile in MSBuild for Database Project

I have a database project in Visual Studio 2012. I am trying to create an MSBuild project to publish the database on the build server. In my solution, I have a Publish Profile that I would like to use on the build server.

I have the following target setup:

<Target Name="BuildDatabases">       
        <MSBuild Projects="$(DBProjectPath)" Targets="Build;Deploy" Properties="DeployOnBuild=true;SqlPublishProfilePath=BuildServer.publish">
        </MSBuild>
    </Target>

I've tried a combination of PublishProfile and SqlPublishProfilePath to no avail. I always receive:

Deploy Error: The connection string is not valid

I can use the Publish Profile inside VS with no connection issues.

Upvotes: 5

Views: 3200

Answers (1)

B Z
B Z

Reputation: 9463

Figured it out:

<Target Name="BuildDatabases">
    <MSBuild Projects="$(DBProjectPath)" Targets="Build;Publish" Properties="DeployOnBuild=true;SqlPublishProfilePath=BuildServer.publish.xml">
    </MSBuild>
</Target>

I had to use "Build;Publish" for target, I was using "Build;Deploy"

Upvotes: 7

Related Questions