dotnet / arcade

Tools that provide common build infrastructure for multiple .NET Foundation projects.
MIT License
657 stars 331 forks source link

Arcade incorrectly determines NuGet cache location #14761

Open sharwell opened 1 month ago

sharwell commented 1 month ago

The following line incorrectly assumes that NuGet cache location is only configured by the NUGET_PACKAGES environment variable:

https://github.com/dotnet/arcade/blob/a62b4639193b96a1a848ccddaf9fe421c3d3f21b/eng/common/tools.ps1#L645

The script further incorrectly assumes that the default cache location when NUGET_PACKAGES is not defined:

https://github.com/dotnet/arcade/blob/a62b4639193b96a1a848ccddaf9fe421c3d3f21b/eng/common/tools.ps1#L651

My machine is configured in %APPDATA%\NuGet\NuGet.Config to use D:\cache\.nuget for the cache location, and I have Windows Deny ACLs enabled on %USERPROFILE%\.nuget to force tools to fail if they incorrectly determine it is acceptable to write data to this location. This is causing Arcade repositories to fail to build without modifying their build scripts to correct the hard-coded locations.

Side note: I use Deny ACLs in many locations as part of validating various products and tools don't make incorrect assumptions that may not hold on end user machines (e.g. telemetry caches on disk should not be used when telemetry reporting is disabled), so this is standard practice and severely impairs my workflow until fixed.

sharwell commented 1 month ago

Also fails here: https://github.com/dotnet/arcade/blob/480401b003bfd2eb989c315da5d6b99ad13a968c/src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props#L11-L12