How to fix Nuget restore for projects using different package sources within same VS solution

  Uncategorised

I’m using VS 2017, and I have a new common project(CommonLib) that needs to be referenced by projects in multiple solutions. For this common project I want to maintain its own packages folder. And after referencing this project into an existing solution (that has a project that refers a different packages folder), nuget restore is not looking at both these package folders.

Not sure if within a single solution nuget restore could search for multiple packages folder to resolve the referencing libraries based on the project file hintPaths.
Also I see that migrating from packages.config to PackageReference would help here, but I don’t want to get rid of packages.config in existing projects, and also not in the new CommonLib project to be consistent.

Here is how my src setup paths are:

UX.Sln - paths: C:SrcUXUX.Sln; C:SrcUXpackages;
    UXSource.csproj - paths: C:SrcUXUXSource; This refers nuget libs from src C:SrcUXpackages
    CommonLib.csproj - paths: C:SrcCommonCommonLib; I want to refer nuget libs from src C:SrcCommonpackages

Api.Sln - paths: C:SrcApiApi.Sln; C:SrcApipackages;
    ApiSource.csproj - paths: C:SrcApiApiSource; This refers nuget libs from src C:SrcApipackages
    CommonLib.csproj - paths: C:SrcCommonCommonLib; I want to refer nuget libs from src C:SrcCommonpackages

Source: Visual Studio Questions

LEAVE A COMMENT