SSDT发布不使用MSBuild命令行

时间:2015-07-10 08:23:13

标签: msbuild sql-server-data-tools

我尝试使用来自my(TeamCity)构建服务器的MSBuild发布.sqlproj项目。我使用.publish.xml来设置大多数发布设置,但是想在命令行上指定连接字符串,因此我可以将其安全地存储在TeamCity属性中。

但是,似乎MSBuild根本不使用命令行中指定的连接字符串,并且坚持使用.publish.xml中的连接字符串。我已经尝试将其从XML中删除并清空它,但MSBuild并不是那么喜欢它,然后回吐Before you can deploy a database, you must specify a connection string in the project properties or at a command prompt.,当然,这正是我的意思。试图做...

用于发布的完整命令如下:

msbuild /t:Build;Publish /p:SqlPublishProfilePath="c:\path\to\profile.publish.xml" /p:Publish_TargetConnectionString="the connection string" "c:\path\to\project.sqlproj"

我也尝试过使用/p:TargetConnectionString/p:SqlPublishProfilePath="c:\path\to\profile.publish.xml";Publish_TargetConnectionString="the connection string",但无济于事。

.publish.xml如下:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <IncludeCompositeObjects>True</IncludeCompositeObjects>
    <TargetDatabaseName><!-- snip --></TargetDatabaseName>
    <DeployScriptFileName><!-- snip -->.sql</DeployScriptFileName>
    <TargetConnectionString><!-- snip snip --></TargetConnectionString>
    <ScriptDatabaseOptions>False</ScriptDatabaseOptions>
    <BlockOnPossibleDataLoss>False</BlockOnPossibleDataLoss>
    <DeployDatabaseInSingleUserMode>False</DeployDatabaseInSingleUserMode>
    <ProfileVersionNumber>1</ProfileVersionNumber>
  </PropertyGroup>
</Project>

SSDT是我可以从微软下载的最新版本。

有没有人让这个工作过?

1 个答案:

答案 0 :(得分:0)

如上所述,我使用MSBuild构建.dacpac和sqlpackage.exe将其发布到SQL Server,并且工作正常。

相关问题