From d261844fc2891e556eaf5f2aff49c725d24bd21f Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Fri, 3 Sep 2021 14:02:30 +0300 Subject: [PATCH] [Windows] postdotnet: delete nuget.conf if exists (#4013) * postdotnet: delete nuget.conf if exists * rename to $nugetConfigPath * add nuget.config check test * remove issue link --- images/win/post-generation/Dotnet.ps1 | 5 +---- images/win/scripts/Tests/ChocoPackages.Tests.ps1 | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/images/win/post-generation/Dotnet.ps1 b/images/win/post-generation/Dotnet.ps1 index 38898b9c..56d2f875 100644 --- a/images/win/post-generation/Dotnet.ps1 +++ b/images/win/post-generation/Dotnet.ps1 @@ -7,8 +7,5 @@ if (-not $latestPath.Contains($dotnetPath)) [System.Environment]::SetEnvironmentVariable('PATH', $latestPath, [System.EnvironmentVariableTarget]::Machine) } -# Delete empty nuget.config file created by choco and recreate the config using the 'dotnet nuget list source command' -# before choco or powershell’s ancient embedded nuget does to prevent the issue with downloading packages from nuget.org -# https://github.com/actions/virtual-environments/issues/3038 -Remove-Item $env:APPDATA\NuGet\NuGet.Config -Force +# Recreate the config using the 'dotnet nuget list source command' dotnet nuget list source diff --git a/images/win/scripts/Tests/ChocoPackages.Tests.ps1 b/images/win/scripts/Tests/ChocoPackages.Tests.ps1 index cb95e095..bb3693ba 100644 --- a/images/win/scripts/Tests/ChocoPackages.Tests.ps1 +++ b/images/win/scripts/Tests/ChocoPackages.Tests.ps1 @@ -44,6 +44,9 @@ Describe "Nuget" { It "Nuget" { "nuget" | Should -ReturnZeroExitCode } + It "NuGet.Config not exists" { + "$env:APPDATA\NuGet\NuGet.Config" | Should -Not -Exist + } } Describe "OpenSSL" {