Reputation: 541
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
Upvotes: -1
Views: 107
Reputation: 541
the simplest way is to reference the dacpac
database file directly in the csproj
from the bin folder like this :
<!-- Include the DACPAC file from the Database project -->
<ItemGroup>
<None Include="..\Stackoverflow.Database\bin\$(Configuration)\Stackoverflow.Database.dacpac" Pack="true" PackagePath="Output\Database\" />
</ItemGroup>
Just make sure the you build the database
project before building the csproj
for exemple if you're packaging and publishing your package from an Azure Pipeline
Then build the database project:
msbuild Stackoverflow.Database.sqlproj /p:Configuration=Release
And build the cs project:
msbuild Stackoverflow.csproj /p:Configuration=Release
And finally pack the library: dotnet pack --configuration Release
Upvotes: 0
Reputation: 5642
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:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- your properties -->
</metadata>
<files>
<file src="readme.txt" target="" />
<file src="path\to\your\DACPAC.dacpac" target="content\DACPAC.dacpac" />
<file src="..\..\databaseproject\**\*.*" target="databaseproject\" />
</files>
</package>
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.
Upvotes: 0