对系统数据库的引用在 SSDT 数据库项目中重复 [英] Reference to system databases becomes duplicated in SSDT database project
问题描述
在一个包含大量项目和引用的大型 SSDT 数据库解决方案中,我将我的项目的引用添加到系统数据库(master、msdb),它运行良好,并且构建成功.
In a huge SSDT database solution with lots of projects and references, I'm adding a reference from my project to system databases(master, msdb), it works well, and the build is successful.
一段时间后,我开始收到有关不正确参考的错误消息.我去参考部分看到这个:https://pasteboard.co/JqzDSDh.png
And after some time I start receiving errors about incorrect reference. I go to the references section and see this: https://pasteboard.co/JqzDSDh.png
我尝试删除第二个引用,错误消失了,但此问题又回来了,我再次看到两个相同的引用.
I tried removing the second reference and the errors were gone but then this issue comes back and I see two identical references again.
谢谢!
推荐答案
很可能是您的 project.sqlproj
文件出了问题.尝试在那里搜索 master.dacpac
关键字并确保没有多个条目.确保 dacpac 路径不是完全硬编码的,而是在那里使用 $(DacPacRootPath)
变量.
Most probably something is wrong with your project.sqlproj
file. Try to search master.dacpac
keyword there and make sure that there is no multiple entries. Make sure that dacpac path is not fully hardcoded, but uses $(DacPacRootPath)
variable there.
这是引用应该是什么样子的示例(确保您在路径中定义了正确的 SQL 版本.我的版本是 140).
This is an example how the reference should look like (make sure that you have the right SQL version defined in the path. Mine one is 140 here).
<ArtifactReference Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\140\SqlSchemas\master.dacpac">
<HintPath>$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\140\SqlSchemas\master.dacpac</HintPath>
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
</ArtifactReference>
如果这没有帮助,请尝试运行Clean Solution",然后删除所有 *.jfm
文件和 *.dbmdl
文件,bin
和 obj
文件夹并重新构建项目.
If that wouldn't help, try to run "Clean Solution", then delete all *.jfm
files and *.dbmdl
files, bin
and obj
folders and re-build the project.
这篇关于对系统数据库的引用在 SSDT 数据库项目中重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!