Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosted VS2017 agent build master.dacpac does not exist

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 ##[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]

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

like image 247
mheptinstall Avatar asked Jul 14 '17 13:07

mheptinstall


People also ask

Where are the Dacpac located?

dacpac file is located in relation to your . NET Framework Web Application solution. The PathToPublish in our example here is '$(Build.

What is master Dacpac?

dacpac and msdb. dacpac files are just like templates which you will use as a default database in your project.

How do I open Dacpac in Visual Studio?

Use one of these two methods to open the Unpack Data-tier Application dialog: Right-click the DAC package (. dacpac) file and select Unpack. Double-click the DAC package file.

What is Dacpac in SQL?

dacpac can be used to update a database with new or modified objects, to revert to a previous version of the database, or to provision an entirely new database. Conversely, a . dacpac can be generated from an existing database and used to establish a SQL database project based on the current database schema.


1 Answers

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"> 
like image 178
Larry Smith Avatar answered Oct 12 '22 02:10

Larry Smith