简体   繁体   English

对系统数据库的引用在 SSDT 数据库项目中重复

[英]Reference to system databases becomes duplicated in SSDT database project

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.在包含大量项目和引用的大型 SSDT 数据库解决方案中,我将我的项目中的引用添加到系统数据库(master、msdb),它运行良好,并且构建成功。

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我去参考部分看到这个: 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.我尝试删除第二个引用,错误消失了,但是这个问题又回来了,我再次看到两个相同的引用。

Thank you!谢谢!

Most probably something is wrong with your project.sqlproj file.您的project.sqlproj文件很可能有问题。 Try to search master.dacpac keyword there and make sure that there is no multiple entries.尝试在那里搜索master.dacpac关键字并确保没有多个条目。 Make sure that dacpac path is not fully hardcoded, but uses $(DacPacRootPath) variable there.确保 dacpac 路径不是完全硬编码的,而是在那里使用$(DacPacRootPath)变量。

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).这是引用应该是什么样子的示例(确保您在路径中定义了正确的 SQL 版本。我的版本是 140)。

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

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.如果这没有帮助,请尝试运行“Clean Solution”,然后删除所有*.jfm文件和*.dbmdl文件、 binobj文件夹并重新构建项目。

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

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