Dotnet build issue with system database reference.
See original GitHub issue- SqlPackage or DacFx Version:0.1.3-preview
- .NET Framework (Windows-only) or .NET Core:.NET Core
- Environment (local platform and source/target platforms): Windows
Steps to Reproduce:
- Create a new database project in Visual Studio
- Follow instructions in this blog to get build working with dotnet build. https://erikej.github.io/ssdt/dotnet/2022/03/07/ssdt-dacpac-netcore.html
- Build should work at this point.
dotnet build /p:NetCoreBuild=true
- Add a reference to the “master” system database in Visual Studio. This creates the following XML:
<ItemGroup>
<ArtifactReference Include="$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\130\SqlSchemas\master.dacpac">
<HintPath>$(DacPacRootPath)\Extensions\Microsoft\SQLDB\Extensions\SqlServer\130\SqlSchemas\master.dacpac</HintPath>
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
</ArtifactReference>
</ItemGroup>
- Build will now fail.
dotnet build /p:NetCoreBuild=true
C:\Users\user1\.nuget\packages\microsoft.build.sql\0.1.3-preview\tools\netstandard2.1\Microsoft.Data.Tools.Schema.SqlTasks.targets(525,5): Build error SQL72027: File “C:\Users\user1\.nuget\packages\microsoft.build.sql\0.1.3-preview\tools\netstandard2.1\Extensions\Microsoft\SQLDB\Extensions\SqlServer\130\SqlSchemas\master.dacpac” does not exist. [c:\Git\TrimbleOSS\dba-dash\Database1\Database1.sqlproj]
Did this occur in prior versions? If not - which version(s) did it work in?
Not applicable to prior version
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Troubleshoot .NET Framework targeting errors
In this article ... This topic describes MSBuild errors that might occur because of reference issues and how you can resolve those errors....
Read more >dotnet build does not see referenced project
Create net461 Core webproject referencing ClassLibrary of same 4.6.1 ... NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find ...
Read more >Troubleshoot broken references - Visual Studio
To fix this problem, use one of the following methods: Delete the broken reference and then replace it by using the Add Reference...
Read more >VS 2019 database project build errors on SQL view that ...
When building the database project VS 2019 errors on a view that contains any sys.* references. The work around is to go to...
Read more >Reference to system databases becomes duplicated in ...
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), ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ErikEJ to be clear, this wasn’t to suggest that Visual won’t get support for the SDK-style project file, but currently an optional workaround is to use Azure Data Studio insiders (or the command line option shared above).
We just released 3 system dacpac Nuget packages that can be referenced via
PackageReference
from projects built with Microsoft.Build.Sql 0.1.9-preview and up. Example:Available packages are:
You can read more about it here: https://learn.microsoft.com/en-us/sql/azure-data-studio/extensions/sql-database-project-extension-sdk-style-projects?view=sql-server-ver16#package-references