托管的VS2017代理程序生成master.dacpac不存在 [英] Hosted VS2017 agent build master.dacpac does not exist

查看:79
本文介绍了托管的VS2017代理程序生成master.dacpac不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用VS2017 Professional创建的解决方案包含一个引用master数据库的SQL Server数据库项目.使用Hosted VS2017代理在Visual Studio Team Services中构建我的解决方案时,出现以下错误:

My solution created with VS2017 Professional contains an SQL Server Database Project that references the master database. When using the Hosted VS2017 agent to build my solution in Visual Studio Team Services I'm getting the errors below:

2017-07-14T12:44:17.8387743Z ## [错误] C:\ Program Files(x86)\ Microsoft 视觉的 Studio \ 2017 \ Enterprise \ MSBuild \ Microsoft \ VisualStudio \ v15.0 \ SSDT \ Microsoft.Data.Tools.Schema.SqlTask​​s.targets(559,5): 错误SQL72027:文件"C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Common7 \ IDE \ Extensions \ Microsoft \ SQLDB \ Extensions \ SqlServer \ 110 \ SqlSchemas \ master.dacpac" 不存在. 2017-07-14T12:44:17.8397816Z C:\ Program文件 (x86)\ Microsoft Visual Studio \ 2017 \ Enterprise \ MSBuild \ Microsoft \ VisualStudio \ v15.0 \ SSDT \ Microsoft.Data.Tools.Schema.SqlTask​​s.targets(559,5): 生成错误SQL72027:文件"C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Common7 \ IDE \ Extensions \ Microsoft \ SQLDB \ Extensions \ SqlServer \ 110 \ SqlSchemas \ master.dacpac" 不存在. [d:\ a \ 3 \ s \ Main \ ItAsset.Database \ ItAsset.Database.sqlproj]

2017-07-14T12:44:17.8387743Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(559,5): Error SQL72027: File "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\110\SqlSchemas\master.dacpac" does not exist. 2017-07-14T12:44:17.8397816Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(559,5): Build error SQL72027: File "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\110\SqlSchemas\master.dacpac" does not exist. [d:\a\3\s\Main\ItAsset.Database\ItAsset.Database.sqlproj]

如何解决此问题并获得在VSTS中构建的解决方案?

How can I fix this and get my solution to build in VSTS?

推荐答案

在多开发人员的情况下,我对此有所了解.这似乎发生在VS2017 SSDT项目中,在该项目中,签入代码的开发人员最初将Visual Studio的安装路径与您或Visual Studio的另一个实例的路径不同.例如,如果开发人员A将默认安装在C:\上,但开发人员B将其VS2017安装到E:\驱动器上,则创建对Master的引用的任何人都可以使用,而其他人找不到dacpac文件.

I just got bit by this in a multi-developer situation. It seems to happen in VS2017 SSDT projects where the developer who checked in the code originally had their installation of Visual Studio in a different path than you, or another instance of Visual Studio. For example if developer A installed to defaults on C:\ but developer B installed his VS2017 to E:\ drive, whoever creates the reference to Master will work, the other will not find the dacpac file.

在.sqlproj文件中,您可能会找到对Master数据库的引用:

Looking in the .sqlproj file, you'll likely find this reference to the Master database:

 <ArtifactReference Include="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\130\SqlSchemas\master.dacpac">
  <HintPath>$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\130\SqlSchemas\master.dacpac</HintPath>

注意:<HintPath>是正确的,但是Include="是硬编码的路径.似乎没有按照通常的方式遵循提示路径.要解决您的问题,请尝试将HintPath元素的内容复制到Include属性.保持HintPath不变.

Note: the <HintPath> is correct, but the Include=" is a hard coded path. It seems that the hint path is not followed as it normally should be. To fix your problem, try copying the contents of the HintPath element to the Include attribute. Leave the HintPath as it is.

<ArtifactReference Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\130\SqlSchemas\master.dacpac">

这篇关于托管的VS2017代理程序生成master.dacpac不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆