简体   繁体   English

VS 2015 MSBuild部署数据库项目错误

[英]VS 2015 MSBuild Deploy Database Project Error

I'm having an issue using VS 2015 MSBuild to deploy a database project via the command line. 我在使用VS 2015 MSBuild通过命令行部署数据库项目时遇到问题。 The issue is I need to be able to use MSBuild with 14.0 only, without VS 2013 installed. 问题是我需要能够仅在没有安装VS 2013的情况下使用仅包含14.0的MSBuild。

I'm using 14.0 MSBuild at: 我在以下位置使用14.0 MSBuild:

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

The following works because I also have Visual Studio 2013 installed with the appropriate SQL Server Data Tools: 之所以可以这样工作,是因为我还安装了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

However, if I change "VisualStudioVersion" to "14.0 for VS 2015, I get an error: 但是,如果将VS 2015的“ VisualStudioVersion”更改为“ 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'.

According to your description, I create a demo and reproduce your issue on my side, you use an incorrect connection string. 根据您的描述,我创建了一个演示并重现了您的问题,您使用了错误的连接字符串。 please modify your command like this: 请像这样修改您的命令:

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

Credit to Cole Wu for saying my connection string was invalid, but his answer didn't work for me out of the box. 感谢Cole Wu所说的我的连接字符串无效,但是他的回答对我开箱即用。 For some reason my connection string was* valid for 12.0 but not for 14.0. 由于某种原因,我的连接字符串*对于12.0有效,但对于14.0无效。

The issue ended up being that I had IntegartedSecurity rather than Integrated Security , which broke my command when moving to 14.0 问题最终是我拥有IntegartedSecurity而不是Integrated Security ,在升级到14.0时这破坏了我的命令

Here is the final that worked: 这是有效的决赛:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM