在MSBuild中使用PublishProfile进行数据库项目的发布

5

我在Visual Studio 2012中有一个数据库项目。我正在尝试创建一个MSBuild项目,将数据库发布到构建服务器上。在我的解决方案中,我有一个发布配置文件,我想在构建服务器上使用。

我设置了以下目标:

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

我尝试了PublishProfile和SqlPublishProfilePath的组合,但都没有成功。我总是收到以下信息:

Deploy Error: The connection string is not valid

我可以在VS中使用发布配置文件,而不会出现连接问题。

1个回答

7

明白了:

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

我必须使用“生成;发布”作为目标,我之前使用的是“生成;部署”


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接