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

Arcade incorrectly determines NuGet cache location #14761

Open
sharwell opened this issue May 10, 2024 · 1 comment · May be fixed by #14763
Open

Arcade incorrectly determines NuGet cache location #14761

sharwell opened this issue May 10, 2024 · 1 comment · May be fixed by #14763

Comments

@sharwell
Copy link
Member

sharwell commented May 10, 2024

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

if ($env:NUGET_PACKAGES -eq $null) {

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

$env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\'

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
Copy link
Member Author

Also fails here:

<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(NUGET_PACKAGES)' != ''">$([MSBuild]::NormalizeDirectory('$(NUGET_PACKAGES)'))</NuGetPackageRoot>
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(OS)' == 'Windows_NT'">$([MSBuild]::NormalizeDirectory('$(UserProfile)', '.nuget', 'packages'))</NuGetPackageRoot>

@sharwell sharwell linked a pull request May 10, 2024 that will close this issue
sharwell added a commit to sharwell/arcade that referenced this issue May 10, 2024
Make sure to account for per-user NuGet.Config as a way to configure the
location of the global packages cache. Avoid setting NuGetPackageRoot in
RepoLayout.props because it is already being set to the correct location
in the *.nuget.g.props files created for each project.

Fixes dotnet#14761
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 a pull request may close this issue.

1 participant