Skip to content

Commit a1cd79a

Browse files
authored
Revert "Update NuGet global packages cache detection" (#14874)
1 parent 7bd62cf commit a1cd79a

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

eng/common/tools.ps1

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -650,20 +650,7 @@ function GetNuGetPackageCachePath() {
650650
# use global cache in dev builds to avoid cost of downloading packages.
651651
# For directory normalization, see also: https://github.com/NuGet/Home/issues/7968
652652
if ($useGlobalNuGetCache) {
653-
# Check NuGet.Config to see if the packages folder has been redirected https://github.com/dotnet/arcade/issues/14761
654-
$nugetConfig = Join-Path $env:APPDATA "NuGet\NuGet.Config"
655-
if (Test-Path -Path $nugetConfig) {
656-
[xml]$nugetConfigXml = Get-Content $nugetConfig
657-
658-
# Set the NUGET_PACKAGES environment variable to match the configured globalPackagesFolder. If there is no
659-
# global packages folder, this expression will evaluate to the empty string which will effectively leave the
660-
# environment variable set to null.
661-
$env:NUGET_PACKAGES = $nugetConfigXml.SelectSingleNode("//configuration/config/add[@key='globalPackagesFolder']").value
662-
}
663-
664-
if ($env:NUGET_PACKAGES -eq $null) {
665-
$env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\'
666-
}
653+
$env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\'
667654
} else {
668655
$env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\'
669656
$env:RESTORENOHTTPCACHE = $true

src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
Properties describing the layout of the repo.
66
-->
77

8+
<PropertyGroup>
9+
<!-- Respect environment variable for the NuGet Packages Root if set; otherwise, use the current default location -->
10+
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' != ''">$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)'))</NuGetPackageRoot>
11+
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(NUGET_PACKAGES)' != ''">$([MSBuild]::NormalizeDirectory('$(NUGET_PACKAGES)'))</NuGetPackageRoot>
12+
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(OS)' == 'Windows_NT'">$([MSBuild]::NormalizeDirectory('$(UserProfile)', '.nuget', 'packages'))</NuGetPackageRoot>
13+
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(OS)' != 'Windows_NT'">$([MSBuild]::NormalizeDirectory('$(HOME)', '.nuget', 'packages'))</NuGetPackageRoot>
14+
</PropertyGroup>
15+
816
<PropertyGroup>
917
<RepoRoot Condition="'$(RepoRoot)' == ''">$([MSBuild]::NormalizeDirectory('$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'global.json'))'))</RepoRoot>
1018
</PropertyGroup>

src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.VsixBuild.targets

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
Writes a stub file to component intermediate directory.
2020
-->
2121

22-
<PropertyGroup>
23-
<ArcadeVisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net472\Microsoft.DotNet.Build.Tasks.VisualStudio.dll</ArcadeVisualStudioBuildTasksAssembly>
24-
</PropertyGroup>
25-
2622
<UsingTask TaskName="Microsoft.DotNet.Build.Tasks.VisualStudio.FinalizeInsertionVsixFile" AssemblyFile="$(ArcadeVisualStudioBuildTasksAssembly)" />
2723

2824
<PropertyGroup>

src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
22
<Project>
33

4+
<PropertyGroup>
5+
<ArcadeVisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net472\Microsoft.DotNet.Build.Tasks.VisualStudio.dll</ArcadeVisualStudioBuildTasksAssembly>
6+
</PropertyGroup>
7+
48
<!-- Default settings for VSIX projects -->
59

610
<PropertyGroup>

0 commit comments

Comments
 (0)