mrward / nuget

Modified version of NuGet.Core that works with MonoDevelop on Linux. Used in the MonoDevelop NuGet addin.
Other
11 stars 4 forks source link

How to redefine cache location in config? #5

Open ArsenShnurkov opened 9 years ago

ArsenShnurkov commented 9 years ago

Here is the directory locations: http://lastexitcode.com/projects/NuGet/FileLocations/ (/root/.local/share/NuGet/Cache in my setup)

Here is the docs for config: https://docs.nuget.org/consume/NuGet-Config-Settings

How to redefine the location of Cache directory?

mrward commented 9 years ago

You cannot redefine the location for the machine wide Cache directory ~/.local/share/NuGet/Cache the location is fixed in code.

mrward commented 9 years ago

No I am wrong. You should be able to set a NuGetCachePath environment variable which will override the default location.

ArsenShnurkov commented 9 years ago

Now I see - https://github.com/mrward/NuGet/blob/master/src/Core/Repositories/MachineCache.cs#L208

Can one stack 2 directories hierarchically (i.e. one for machine-level and one for user level), like nuget does that for config files? I can create overlayfs directory for that outside of nuget, but I want to understand does nuget supports that itself, or what should be added to support that...

There is an example of joining 2 repositories in NuGetDefault.Config

<activePackageSource><add key="All" value="(Aggregate source)"  /></activePackageSource>

that is why i think that Cache may be multilevel too...

mrward commented 9 years ago

There is no support for multiple levels of cache directory as far as I am aware. There is only one machine cache that NuGet uses whilst it is running so it would not look in multiple cache directories to see if there was a NuGet package stored locally.

You could create a package source that points to your cache directory so it is treated as a package source. Not sure if that helps since you would need to either explicitly select it in MonoDevelop or use the aggregate package source.

psandhu79 commented 6 years ago

"You could create a package source that points to your cache directory so it is treated as a package source."

Is the recommend ? Just wondering i set the global download cache to a network drive and if i have two build agents using the global cache if both are trying to download the same package at the same time. I can errors that files are in use.

However once download i dont see any problems.

mrward commented 6 years ago

@psandhu79 - This is probably a question for the NuGet team. I suspect NuGet is not expecting multiple instances of itself to be downloading NuGet packages at the same time to the global cache.