Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -650,20 +650,7 @@ function GetNuGetPackageCachePath() {
# use global cache in dev builds to avoid cost of downloading packages.
# For directory normalization, see also: https://github.com/NuGet/Home/issues/7968
if ($useGlobalNuGetCache) {
# Check NuGet.Config to see if the packages folder has been redirected https://github.com/dotnet/arcade/issues/14761
$nugetConfig = Join-Path $env:APPDATA "NuGet\NuGet.Config"
if (Test-Path -Path $nugetConfig) {
[xml]$nugetConfigXml = Get-Content $nugetConfig

# Set the NUGET_PACKAGES environment variable to match the configured globalPackagesFolder. If there is no
# global packages folder, this expression will evaluate to the empty string which will effectively leave the
# environment variable set to null.
$env:NUGET_PACKAGES = $nugetConfigXml.SelectSingleNode("//configuration/config/add[@key='globalPackagesFolder']").value
}

if ($env:NUGET_PACKAGES -eq $null) {
$env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\'
}
$env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\'
} else {
$env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\'
$env:RESTORENOHTTPCACHE = $true
Expand Down
8 changes: 8 additions & 0 deletions src/Microsoft.DotNet.Arcade.Sdk/tools/RepoLayout.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
Properties describing the layout of the repo.
-->

<PropertyGroup>
<!-- Respect environment variable for the NuGet Packages Root if set; otherwise, use the current default location -->
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' != ''">$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)'))</NuGetPackageRoot>
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(NUGET_PACKAGES)' != ''">$([MSBuild]::NormalizeDirectory('$(NUGET_PACKAGES)'))</NuGetPackageRoot>
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' and '$(OS)' == 'Windows_NT'">$([MSBuild]::NormalizeDirectory('$(UserProfile)', '.nuget', 'packages'))</NuGetPackageRoot>
Copy link
Contributor

Choose a reason for hiding this comment

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

My system will not load any arcade-based code in Visual Studio or build any arcade-based repo from the command line with this invalid code in place.

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

<PropertyGroup>
<RepoRoot Condition="'$(RepoRoot)' == ''">$([MSBuild]::NormalizeDirectory('$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'global.json'))'))</RepoRoot>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
Writes a stub file to component intermediate directory.
-->

<PropertyGroup>
<ArcadeVisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net472\Microsoft.DotNet.Build.Tasks.VisualStudio.dll</ArcadeVisualStudioBuildTasksAssembly>
</PropertyGroup>

<UsingTask TaskName="Microsoft.DotNet.Build.Tasks.VisualStudio.FinalizeInsertionVsixFile" AssemblyFile="$(ArcadeVisualStudioBuildTasksAssembly)" />

<PropertyGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>

<PropertyGroup>
<ArcadeVisualStudioBuildTasksAssembly>$(NuGetPackageRoot)microsoft.dotnet.build.tasks.visualstudio\$(MicrosoftDotNetBuildTasksVisualStudioVersion)\tools\net472\Microsoft.DotNet.Build.Tasks.VisualStudio.dll</ArcadeVisualStudioBuildTasksAssembly>
</PropertyGroup>

<!-- Default settings for VSIX projects -->

<PropertyGroup>
Expand Down