sql-servervisual-studionugetdacpacnuspec

Visual Studio - Publish dacpac as NuGet package in so other DB Projects can reference the DB


I'm working on setting up a new organization where we are currently using VS 2017 and creating many SQL Server (2016) DB projects.

I've set up a private NuGet server on Azure to be able to use packages in each new project and my ideal solution would be to publish the helper DB Stored Procs, User Defined Types, etc as separate Nuget packages and be able to import them separately for any new projects to keep everything separated, versioned, etc.

Reading online, I've seen it seems possible to publish dacpac packages to Nuget using .nuspec files, but I can't figure out neither how to do this nor, more specifically, if there's a way to do this directly from Visual Studio.

Any help / pointers would be amazing!!

Thanks!


Solution

  • Visual Studio - Publish dacpac as NuGet package in so other DB Projects can reference the DB

    Actually, as you think, Database project does not support Nuget so far in VS due to some reasons.

    In fact, it is really convenient to use nuget in database project. I agree with you on this point.

    Nuget does make it easy to import a dacpac file into a project(if it can be done), just by adding these to the xxx.nuspec file:

    <files>
    <file src="xxx\xxx.dacpac" target="content">
    </files>
    

    Then it will import such file by nuget automatically in the new project.

    And there is someone else who also wants this feature.

    Suggestion

    You can suggest a feature on our User Voice Forum to report your thought. And you can also share the link here and anyone who is interested in it including us will vote for you so that it will cause Microsoft to attach great importance.