Hosted VS2017 agent build master.dacpac does not exist

It uses the absolute path that isn’t existing in Hosted VS2017 agent. (Professional vs Enterprise). You can check project file (open sqlproj file via nodepad)

You can copy master.dacpac to your project folder and include it to project, then add the reference to this file.


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.

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>

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

This is a bug in SSDT for Visual Studio 2017.

The workaround is to manually edit the project file(s) replacing the full path with the $(DacPacRootPath) variable. Or, you can use SSDT for Visual Studio 2015.

https://feedback.azure.com/forums/908035-sql-server/suggestions/32897047-visual-studio-2017-ssdt-adds-hardcoded-master-dacp#comments

8/12/2019 Update - This bug has been fixed in Visual Studio 2019 and Visual Studio 2017 version 15.9.13. See here - https://developercommunity.visualstudio.com/content/problem/124214/visual-studio-2017-ssdt-adds-hardcoded-mmsdb-andor.html