The goal is to build a NuGet Package, that also depends on an SQLProj that will produce a DACPAC file.
So when building the project that is using this NuGet Package, the goal is to access the DACPAC file when releasing the application in the Azure Pipeline Release:
The Application depends on this NuGet Package but also needs to pack the database project with that package to be able to access the DACPAC file included in the Nuget during the release of the application
2
Answers
the simplest way is to reference the
dacpac
database file directly in thecsproj
from the bin folder like this :Just make sure the you build the
database
project before building thecsproj
for exemple if you're packaging and publishing your package from an Azure PipelineThen build the database project:
And build the cs project:
And finally pack the library:
dotnet pack --configuration Release
You can refer Add a readme and other files to use the
<files>
node in the.nuspec
file, which follows the<metadata>
tag to add your required database project or DACPAC file to the nuget package.Sample
.nuspec
file:Once the NuGet package has been created, you can use it in other projects to access the DACPAC file by installing the NuGet package in your project.