繁体   English   中英

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

[英]VS 2015 MSBuild Deploy Database Project Error

我在使用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

但是,如果将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'.

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

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

感谢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

暂无
暂无

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

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