1

Within several projects I worked in, there would be one or more NuGet packages in a private feed for common code.

When just adding new functions / classes to these NuGet packages there is no issue, but when you want to remove or refactor methods then you would like to know

  • what projects (consuming the private NuGet package) need to be updated / refactored as well
  • what code in the private NuGet package might actually have become redundant (so that it can be removed immediately)

I'm wondering what practices people have to keep track of this?

Options I could think of are:

  • maintaining a "mega solution" (a solution containing all projects of your team) containing your NuGet project as a ProjectReference instead of as a PackageReference so that you can use Visual Studios reference tracking features (see below)
  • just doing the refactoring you want in the private NuGet, publishing it as a new version and fixing the consuming projects when they update to the new version

enter image description here

hansmbakker
  • 1,108
  • 14
  • 29
  • Did you want to find some ways to track some functions from the nuget package to distinguish which nuget package they came from? You can use [xml document comment](https://learn.microsoft.com/en-us/visualstudio/ide/reference/generate-xml-documentation-comments?view=vs-2019) in nuget project. When you use the function,you can find the reminding info under the cursor. – Mr Qian Aug 12 '20 at 09:47
  • no, I'm not concerned about where functions originate from. I want to track what projects reference the classes or methods of my nuget package – hansmbakker Aug 13 '20 at 11:34

1 Answers1

0

Best practices to keep track of dependencies on code in private NuGet package

I think you can try Resharper extension.

Note that this is a paid extension and the new user can use it for 30 days for free.

In my impression, you can use it to inspect which projects reference which nuget package methods. You can check Analyze and Optimize Project References.

And hope that Resharper can meet your requirements. If it still does not meet your needs, I think you could suggest a feature on your User Voice Forum.

When you finish it, you could also share your idea ticket link here and anyone who is interested in it will vote it so that it will get more Team's attention.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • that looks interesting, but it is not exactly what I was looking for. I might open a feedback item indeed. My concern is not analysing what assemblies can be removed or what methods are referenced, but **getting insight in what nuget methods are referenced by no solution at all**. Such a multi-solution insight is offered by no tool, I'm afraid. – hansmbakker Aug 31 '20 at 21:03
  • Imagine you are the maintainer of a library and you want to deprecate or remove a method or class. How do you find out the usage of that method or class to assess the impact of removing it? – hansmbakker Aug 31 '20 at 21:06
  • Actually, it is a feature request and current VS cannot realize it.I think you should suggest a feature on the forum:) – Mr Qian Sep 02 '20 at 07:27