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.
pubxml and are located in the PublishProfiles folder. The PublishProfiles folder is under Properties in a C# web application project, under My Project in a VB web application project, or under App_Data in a web site project.
The Publish DACPAC task simplifies the use of SqlPackage.exe to deploy a database from a DACPAC using a DAC Publish Profile. The great thing about DAC Publish Profiles is that they give you fine-grained control over how your database is upgraded.
In order to create a new profile once you have already defined one, you have to open the "Publish" window (righ click on the project), click on the "Profile" tab and select the <New...> option from the drop-down list; this will create a new pubxml file (see screenshot).
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With