Skip to content

Paket does not use global nuget cache directory set in configuration file #3853

Closed

Description

@audun

Description

Using nuget config it's possible to select an alternative nuget cache location: https://docs.microsoft.com/en-us/nuget/consume-packages/configuring-nuget-behavior

However, Paket does not properly use the configured value, causing some strange and confusing error messages, for example:

Package C:\src\project\packages\Microsoft.AspNet.Razor\microsoft.aspnet.razor.4.0.0-beta7.nupkg couldn't be extracted to "C:\src\project\packages\Microsoft.AspNet.Razor". System.IO.InvalidDataException: End of Central Directory record could not be found.. Trying to extract files individually.

Repro steps

  1. Set an alternate cache directory: nuget config -set globalPackagesFolder=e:\nuget\packages

  2. Verify the configuration: nuget config globalPackagesFolder, should return e:\nuget\packages

  3. Use paket restore

Expected behavior

Downloaded packages should be put in e:\nuget\packages

Actual behavior

Downloaded packages end up in C:\Users\user\.nuget\packages

Known workarounds

Setting the environment variable set NUGET_PACKAGES=e:\nuget\packages works.

Activity

  1. audun commented on May 25, 2020

    @audun
    Author

    A bit more complete error log:

      ==> Trying again
    Downloading Microsoft.AspNet.Razor 4.0.0-beta7
    Not moving as 'C:\Users\user\.nuget\packages\microsoft.aspnet.razor\4.0.0-beta7\microsoft.aspnet.razor.4.0.0-beta7.nupkg' already exists (maybe some other instance downloaded it as well)
    Download of Microsoft.AspNet.Razor 4.0.0-beta7 done in 3 seconds. (878 kbit/s, 0 MB)
    Package C:\src\project\packages\Microsoft.AspNet.Razor\microsoft.aspnet.razor.4.0.0-beta7.nupkg couldn't be extracted to "C:\src\project\packages\Microsoft.AspNet.Razor". System.IO.InvalidDataException: End of Central Directory record could not be found.. Trying to extract files individually.
    Something went wrong while downloading Microsoft.AspNet.Razor 4.0.0-beta7
    Message: Error during extraction of C:\src\project\packages\Microsoft.AspNet.Razor\microsoft.aspnet.razor.4.0.0-beta7.nupkg.
    
  2. github-actions commented on Sep 1, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    This has already been fixed by commit 3e84a7742 ("Use NuGet.Configuration to get the path to the NuGet global packages folder"), which explicitly references this issue. Paket's Constants.UserNuGetPackagesFolder now resolves via NuGet.Configuration.SettingsUtility.GetGlobalPackagesFolder, which respects globalPackagesFolder set via nuget.config, matching the expected behavior described here.

    Recommend closing this issue as fixed. Please reopen if the behavior still reproduces on a recent Paket release.

    Generated by 🌈 Repo Assist, see workflow run. Learn more.
    Comment /repo-assist to run again

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@ae8d551f07c7ed7619f8c58c7bb4c3ac89395d38
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions