【问题标题】:VS 2015 MSBuild Deploy Database Project ErrorVS 2015 MSBuild 部署数据库项目错误
【发布时间】:2017-03-29 17:17:34
【问题描述】:

我在使用 VS 2015 MSBuild 通过命令行部署数据库项目时遇到问题。问题是我需要能够在没有安装 VS 2013 的情况下仅使用 14.0 的 MSBuild。

我正在使用 14.0 MSBuild:

C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe

因为我还安装了 Visual Studio 2013 和相应的 SQL Server 数据工具,所以以下工作有效:

MSBUILD "C:\Users\XYZ\Desktop\temp\Testing\TestProject\TestProject.sqlproj" /t:build "/p:Platform=AnyCPU" /t:deploy "/p:TargetConnectionString=Data Source=localhost;IntegratedSecurity=True" /p:TargetDatabase=TestDeployDb /p:Configuration=Release /p:VisualStudioVersion=12.0

但是,如果我将“VisualStudioVersion”更改为“VS 2015 的 14.0”,则会出现错误:

Deploy error Deploy72002: Unable to connect to master or target server 'TestDeployDb'. You must have a user with the same password in master or target server 'TestDeployDb'.

【问题讨论】:

    标签: sql-server visual-studio visual-studio-2015 msbuild database-project


    【解决方案1】:

    感谢Cole Wu 说我的连接字符串无效,但他的回答对我来说并没有开箱即用。由于某种原因,我的连接字符串*对 12.0 有效,但对 14.0 无效。

    问题最终是我有 IntegartedSecurity 而不是 Integrated Security,这在移动到 14.0 时破坏了我的命令

    这是最后的工作:

    MSBUILD "C:\Users\XYZ\Desktop\temp\Testing\TestProject\TestProject.sqlproj" /t:build "/p:Platform=AnyCPU" /t:deploy /p:TargetConnectionString="Data Source=localhost;Integrated Security=True" /p:TargetDatabase="TestDeployDb" /p:Configuration=Release /p:VisualStudioVersion=14.0
    

    【讨论】:

    • 很高兴知道您解决了这个问题,并感谢您分享解决方案。请将其标记为答案,这将对有类似问题的其他社区成员非常有益。
    • 会的。因为这是我的回答,所以有一个“等待期”。所以我会尽可能标记它。
    【解决方案2】:

    根据您的描述,我创建了一个演示并在我这边重现了您的问题,您使用了不正确的连接字符串。请像这样修改您的命令:

    MSBUILD "C:\Users\XYZ\Desktop\temp\Testing\TestProject\TestProject.sqlproj" /t:build "/p:Platform=AnyCPU" /t:deploy /p:TargetConnectionString="Data Source=localhost;IntegratedSecurity=True" /p:TargetDatabase="TestDeployDb" /p:Configuration=Release /p:VisualStudioVersion=14.0
    

    【讨论】:

      猜你喜欢
      • 2012-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多