Skip to content

Use NuGet.Configuration to get the path to the NuGet global… - #4301

Merged
forki merged 1 commit into
fsprojects:masterfrom
Numpsy:use_config_lib
Nov 11, 2025
Merged

forki merged 1 commit into
fsprojects:masterfrom
Numpsy:use_config_lib

Conversation

@Numpsy

@Numpsy Numpsy commented Jun 25, 2025 •

Copy link
Copy Markdown
Contributor

… packages folder

refs
#3853
#4209

I don't know the history of things in this area, I just hit #3853 when building some things that use paket on a system that has the globalPackagesFolder setting set to a custom location (on a different drive than the default user profile directory) and wondered if it would be possible to fix it by using the 'where is the cache folder' functionality in NuGet.Configuration rather than doing it locally (it contains the logic to look for NUGET_PACKAGES, then globalPackagesFolder, then the regular defaults)

@baronfel

Copy link
Copy Markdown
Contributor

Definitely highly in favor of using NuGet'a apis to interface with parts of the system that they directly control. Love to see more of this.

@smoothdeveloper

Copy link
Copy Markdown
Contributor

Giving a look at https://github.com/fsprojects/Paket/issues?q=NUGET_PACKAGES and places in the repository that mentions this environment variable maybe a small safety measure, to know how bad changing things would break.

I get the feeling NUGET_PACKAGES not being used anymore will break people, and maybe some CI users.

But conceptually, using another folder than the one nuget client uses, seems counter-natural, in today's environment.

Could we add an entry in release notes, IIUC, that mentions that this environment variable is not used anymore and that it will leverage the ambient nuget environment instead?

@Numpsy

Numpsy commented Jun 25, 2025

Copy link
Copy Markdown
Contributor Author

@Numpsy Numpsy changed the title [Testing] Use NuGet.Configuration to get the path to the NuGet global… Use NuGet.Configuration to get the path to the NuGet global… Aug 3, 2025
@Numpsy
Numpsy marked this pull request as ready for review August 3, 2025 10:23
@Numpsy

Numpsy commented Aug 3, 2025

Copy link
Copy Markdown
Contributor Author

This works for me when doing local builds of FAKE anyway -

  • With a plain restore, it puts the packages in the cache path configured for my user
  • If I set NUGET_PACKAGES to a custom path before doing a restore, the packages get put in that folder

@@ -114,12 +114,9 @@ let GitRepoCacheFolder = Path.Combine(LocalRootForTempData,".paket","git","db")
let [<Literal>] GlobalPackagesFolderEnvironmentKey = "NUGET_PACKAGES"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gets referenced from

let _ = directPaketInPathExWithEnv "restore" (scenarioTempPath "extracted-package-permissions") [Paket.Constants.GlobalPackagesFolderEnvironmentKey, localNugetDir]
so I suppose removing that would be a breaking change

@forki

forki commented Nov 11, 2025

Copy link
Copy Markdown
Member

thanks! this will go into 10.0.0-alpha006

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants