簡體   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