Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NuGet Source should search in fallbackFolders if package is not found in packagesPath #352

Closed
JanMattner opened this issue Apr 8, 2021 · 1 comment · Fixed by #366
Closed

Comments

@JanMattner
Copy link

JanMattner commented Apr 8, 2021

Typically, the System/MS packages are not stored in the user's NuGet cache folder, but in the SDK's "Fallback Folder".

Part of my project.assets.json:

  "packageFolders": {
    "C:\\Users\\jan.mattner\\.nuget\\packages\\": {},
    "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {}
  },
  "project": {
    "version": "1.1.2289.7",
    "restore": {
      "projectUniqueName": "C:\\path\\to\\project\\myproject.csproj",
      "projectName": "MyProject",
      "projectPath": "C:\\path\\to\\project\\myproject.csproj",
      "packagesPath": "C:\\Users\\jan.mattner\\.nuget\\packages\\",
      "outputPath": "C:\\path\\to\\project\\obj\\",
      "projectStyle": "PackageReference",
      "crossTargeting": true,
      "fallbackFolders": [
        "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
      ],

Currently, the NuGet Source only considers:
https://github.com/github/licensed/blob/0d31c466dabaea259ccef45dd5ad823c56a29780/lib/licensed/sources/nuget.rb#L184

Then with the licensed cache command I get the following warning:

   * Warnings:
    * MyProject.nuget.Microsoft.CSharp-4.0.1
      - expected dependency path C:\Users\jan.mattner\.nuget\packages\microsoft.csharp/4.0.1 does not exist

But in fact, it exists at C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.csharp\4.0.1

So I propose that if the file is not found in the "primary" packagesPath, then it should search all the other fallbackFolders.

@JanMattner JanMattner changed the title NuGet Source should search in fallbackFolders it package is not found in packagesPath NuGet Source should search in fallbackFolders if package is not found in packagesPath Apr 8, 2021
@jonabc
Copy link
Contributor

jonabc commented Apr 8, 2021

👋 Hi @JanMattner thanks for bringing this up! There's a PR about this that's been open for quite awhile at #273, I'll take another look at that and see if I can clean that up to get it merge-able.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants