我在 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 内使用发布配置文件,没有连接问题。
最佳答案
弄清楚了:
<Target Name="BuildDatabases">
<MSBuild Projects="$(DBProjectPath)" Targets="Build;Publish" Properties="DeployOnBuild=true;SqlPublishProfilePath=BuildServer.publish.xml">
</MSBuild>
</Target>
我必须使用“Build;Publish”作为目标,我正在使用“Build;Deploy”
关于msbuild - 在 MSBuild 中使用 PublishProfile 进行数据库项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13713093/