0

我有一个问题,使用VS 2015 MSBuild通过命令行部署数据库项目。问题是我需要能够使用14.0的MSBuild,没有安装VS 2013。VS 2015 MSBuild部署数据库项目错误

我使用的是14.0的MSBuild在:

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

下面的作品,因为我也有相应的SQL Server数据工具安装Visual Studio 2013:

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'.

回答

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 
+0

我很高兴认识你解决了这个问题和感谢共享解决方案。请将其标记为答案,对于有类似问题的其他社区成员将非常有利。 –

+0

会做。有一个“等待期”,因为这是我的答案。所以我会尽可能标记它。 – Sharpiro

1

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

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