Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using nuget within VS solution with only database dbproj projects to reference other dbproj files

So I have a Visual Studio solution which contains 3 database (.dbproj) projects. These projects need to reference other sql projects from other solutions, which I have packaged and uploaded to nuget. How can I manage these external packages / references in Visual Studio within the dbproj's?

Right clicking the database project within visual studio doesn't give me the "Manage NuGet Packages..." option.

I can Manage NuGet Packages for Solution to at least download the required packages to the solution root but at the project level, where the references are required I'd have to manually manage the references within each projects' references and update manually any time the package is updated so the reference points to the correct versioned package directory.

Is there a better way to do this for dbproj references for database projects in Visual Studio??

like image 377
geoid Avatar asked Mar 28 '13 14:03

geoid


People also ask

Can I install NuGet packages into sqlproj projects?

Being able to install NuGet packages into .sqlproj projects (and .dbproj) will take the NuGet solution to the next level, with the Continuous Integration problem, as Continuous Database Integration is a critical part of an effective CI/CD solution for a modern, and agile team.

How do I install a NuGet package in Visual Studio?

NuGet packages can be installed into any.NET project, provided that the package supports the same target framework as the project. For this walkthrough, use a simple WPF app. Create a project in Visual Studio using File > New Project, typing.NET in the search box, and then selecting the WPF App (.NET Framework).

Why do we generate NuGet packages?

We generate internal NuGet packages for a product that get installed into different solutions. One package (just been created) holds a set of SQL files and the generated assembly from the product database project. This is mainly to help make DB packaging deployments a lot smoother and less error prone.

Do I need a NuGet dependency on B?

But when you come to publish B you will want B to have a nuget dependency on A. Not a direct reference. So ideally, you develop and publish A and B separately to ensure your tests are reflective of the final product. I do think its common practice to skip this though and the new .net core build chain likes to make every project a nuget.


1 Answers

I ended up following the same path, creating NuGet packages of the referenced databases and then manually (via command line) installing them at the standard \package location. Then correcting the database references manually in the IDE

There is a work item for this functionality, go vote it up. There is a fork of the functionality already developed that sounds like it is fairly feature complete. You might try it out.

like image 192
RobRolls Avatar answered Oct 20 '22 15:10

RobRolls