Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 292
B Z Avatar asked Dec 04 '12 22:12

B Z


People also ask

Where are Pubxml files stored?

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.

What is Dacpac Publish profile?

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.

How do I create a Pubxml file?

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).


1 Answers

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"

like image 107
B Z Avatar answered Oct 18 '22 21:10

B Z