Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a smart way to deal with package dependencies in NuGet?

We are developing a WPF application at work which has various "common" dependencies (Unity, Prism, etc.).

It's all fine when adding new projects and then setting up the NuGet package dependency per project but when it comes to upgrades, it's really painful as it means we have to go through each and every project, delete the old references and then refetch the latest packages from NuGet.

Today for instance, I was tasked with upgrading Prism from 5.0 to 6.0 (which has breaking changes anyway) and this meant, in addition to fixing all the namespace conflicts, etc. that I had to go through every project, delete the old references, add the new dependecies and rinse and repeat.

My question is, is there a smarter way to deal with this problem or is this the standard approach?

Many thanks in advance,

Update:

I am mostly concerned with "major" upgrades which don't show up on the package manager. Version 5.0 -> 6.0 upgrade would be treated as a major upgrade and hence, would not have an automatic update applied to it in the NuGet package manager.

I don't expect NuGet to be able to do this automatically for me since such upgrades may (and often do) include breaking changes but I would like to know if there's a way to do the major upgrades less painfully than deleting the references from the projects and the packages.config for every project and then re-adding them using NuGet. For a relatively large project, this is very time consuming and I was wondering if anyone had a better way of managing such dependencies.

like image 340
kha Avatar asked Sep 22 '15 07:09

kha


1 Answers

If you use VS2013 like you say, you can manage ALL your NuGet packages by right-clicking on your Solution and selecting 'Manage NuGet Packages For Solution'. This brings up a dialog where you can view all packages installed for all projects in the solution and all packages that have updates available. When you do upgrade the packages, VS takes care of all the reference changes required. If the package has breaking changes, then you're still on the hook for fixing those.

Disclaimer: I've never worked on a WPF project/solution but for Web/Forms apps, NuGet packages are handled this way.

like image 73
djm61 Avatar answered Oct 26 '22 18:10

djm61