简体   繁体   English

VS 2019 中的 master.dacpac 来自哪里?

[英]Where does master.dacpac come from in VS 2019?

We have some build tasks that run and for the life of me I can't figure out why the ms build tools isn't installing the master.dacpac file needed for the master and the msdb dacpac files.我们有一些正在运行的构建任务,对于我来说,我无法弄清楚为什么 ms 构建工具没有安装 master 和 msdb dacpac 文件所需的 master.dacpac 文件。

Here's where it lives now:它现在住在这里:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SQLSchemas C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SQLSchemas

Currently, in VS2019 Professional it is added with the Data Storage and Processing Workload.目前,在 VS2019 Professional 中,它添加了数据存储和处理工作负载。 SQL Server Data Tools is a dependency for several other workloads, such as: SQL 服务器数据工具是其他几个工作负载的依赖项,例如:

ASP.NET and web development ASP.NET and web development tools Azure Data Lake and Stream Analytics Tools Cloud tools for web development In MS Build Tools, I noticed that the dacpac file isn't generated after installing the Data Tools workload. ASP.NET and web development ASP.NET and web development tools Azure Data Lake and Stream Analytics Tools Cloud tools for web development In MS Build Tools, I noticed that the dacpac file isn't generated after installing the Data Tools workload.

Am I looking in the wrong place?我找错地方了吗? What is generating the master.dacpac and the msdb.dacpac in C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SQLSchemas?是什么在 C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SQLSchemas 中生成 master.dacpac 和 msdb.dacpac?

Am I looking in the wrong place?我找错地方了吗? What is generating the master.dacpac and the system.dacpac in C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SQLSchemas?是什么在 C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SQLSchemas 中生成 master.dacpac 和 system.dacpac?

As far as l know, the master.dacpac and msdb.dacpac files are just like templates which you will use as a default database in your project.据我所知, master.dacpacmsdb.dacpac文件就像您将在项目中用作默认数据库的模板。 They are being used in developing a database project in VS2019.它们被用于在 VS2019 中开发数据库项目。

Test测试

I have installed a new VS2019 Professional version in my machine.我已经在我的机器上安装了一个新的 VS2019 Professional 版本。 Firstly, I installed the workload .Net desktop development and the files were not generated in the target path.首先,我安装了工作负载.Net desktop development ,并且文件没有在目标路径中生成。 Then I installed the Data Storage and processing workload and found the files were installed.然后我安装了Data Storage and processing工作负载,发现文件已安装。 After that, I tried to install the corresponding module in the Build Tool, but that did not generate the files.之后,我尝试在构建工具中安装相应的模块,但没有生成文件。

Based on this, I can confirm that this file is generated when you are installing Data Storage and processing workload in the VS2019 IDE rather than Build Tool.基于此,我可以确认该文件是您在 VS2019 IDE 而不是 Build Tool 中安装Data Storage and processing工作负载时生成的。

Further, for Build Tool which is used for building projects including database projects, the files will not be generated when installing Build Tool, it is just by designed.此外,对于用于构建包括数据库项目在内的项目的Build Tool,安装Build Tool时不会生成文件,它只是设计好的。

Sample样本

<ArtifactReference Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac">
      <HintPath>$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SqlSchemas\master.dacpac</HintPath>
    <SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
    <DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue></ArtifactReference>

When you reference the system database when developing in VS2019, the hintpath will be VS2019开发时引用系统数据库时,提示路径为

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\Extensions\SqlServer\150\SQLSchemas`.

And $(DacPacRootPath) will choose like C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE .并且$(DacPacRootPath)将选择C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE

But when you use Build Tool to build this project in another machine without installing VS2019, you could facethis issue which was reported by some customers.但是当您使用 Build Tool 在另一台机器上构建这个项目而没有安装 VS2019 时,您可能会遇到一些客户报告的这个问题

>> If you face it, you can refer to it and Microsoft seems to have a fix in the latest version of MSBuild Tool. >>如果遇到了,可以参考一下,微软似乎在最新版的 MSBuild Tool 中有修复。

In addition , if you just want MSBuild Tool to generate the master.dacpac file in MSBuild folder, you can suggest a feature toDC Forum to reflect it.另外,如果你只是想让MSBuild工具在MSBuild文件夹中生成master.dacpac文件,你可以向DC论坛推荐一个特性来反映它。

Hope it can help you.希望它可以帮助你。

As Lance Li suggested these files are indeed being installed, not generated And yes, there was a bug in VS 2019 Build Tools which was fixed in 16.4.1 version of Build Tools .正如Lance Li建议的那样,这些文件确实正在安装,而不是生成 是的,VS 2019 Build Tools 中存在一个错误,该错误已在16.4.1 版本的 Build Tools中修复。

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

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