Is there a way to see which package source an installed NuGet package is installed in in Visual Studio?

In the Visual Studio NuGet Package Manager, you can see which NuGet packages have been installed in a solution by clicking the Installed tab in the Package Manager.

However, in situations where the same package is found in multiple NuGet package sources, it might be helpful to see which package source came from a specific NuGet package. Is there a way to see this in NuGet Package Manager or somewhere else in VS?

Edit: Copying in my comment below for clarification:

I am creating a project using an existing one as a model. Both projects will need to reference the same Nuget packages, so I open my model project in Visual Studio, open the Nuget Package Manager and see its installed packages. The model project has "PackageA" installed. I open a new project, open the Nuget Package Manager for it and look at "PackageA". I notice that "PackageA" is available in several package sources. (These are internal to my company, not nuget, org). In my new project, I would like to install "PackageA" from the same package source as the model project

+6


source to share


1 answer


Is there a way to see which package source an installed NuGet package is installed in in Visual Studio?

Simple answer: No. This is because information about which NuGet packages were installed in a solution under the Installed tab in Package Manager is file-based packages.config

. This file only has package options ID, version, targetFramework

, so we can get information about NuGet sources in the package manager based on the package Packages.config

.

Also, when we use NuGet to manage our packages, NuGet downloads the packages from NuGet Package Sources and installs those packages in Packages

the solution folder. What we need to do next is related to the packages in the Packages folder, not the NuGet Package Sources (except for NuGet restore, Restore just downloads the packages from NuGet Package Sources). So we couldn't find the source of the package just based on the package that was already downloaded without the source package information in Package.config.



What's more, when we use NuGet to download packages, NuGet will look for NuGet Package sources one by one to download, NuGet can't be smart about storing the Package Sources from which each package is downloaded.

I would like to install "PackageA" from the same package source as the model project

To resolve this issue , you can open the Packages folder, copy the PackagesA, install it into the NuGet package source you want to use, and then install the PackageA from that package source, you will get the same package as the model project,

+2


source







All Articles