diff --git a/build_projects/dotnet-cli-build/build.ps1 b/build_projects/dotnet-cli-build/build.ps1 index 73f5f5e9d..8094ed22c 100644 --- a/build_projects/dotnet-cli-build/build.ps1 +++ b/build_projects/dotnet-cli-build/build.ps1 @@ -10,6 +10,21 @@ param( [switch]$NoPackage, [switch]$Help) +function RemoveDirectory([string] $path) +{ + if (Test-Path $path) + { + Remove-Item $path -Recurse -Force + } +} + +function CleanNuGet() +{ + RemoveDirectory($env:LocalAppData + "\NuGet\Cache") + RemoveDirectory($env:LocalAppData + "\NuGet\v3-cache") + RemoveDirectory($env:NUGET_PACKAGES) +} + if($Help) { Write-Host "Usage: .\build.ps1 [-Configuration ] [-NoPackage] [-Help] [-Targets ]" @@ -63,6 +78,12 @@ if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" } # Put the stage0 on the path $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" +# Ensure clean package folder and caches +CleanNuGet + +# Disable first run since we want to control all package sources +$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + # Restore the build scripts Write-Host "Restoring Build Script projects..." pushd "$PSScriptRoot\.." diff --git a/build_projects/dotnet-cli-build/build.sh b/build_projects/dotnet-cli-build/build.sh index 2ec1a8a24..77fd912ca 100755 --- a/build_projects/dotnet-cli-build/build.sh +++ b/build_projects/dotnet-cli-build/build.sh @@ -101,6 +101,14 @@ then ulimit -n 1024 fi +# Clean old NuGet packages +rm -rf "$HOME/.local/share/NuGet/Cache" +rm -rf "$HOME/.local/share/NuGet/v3-cache" +rm -rf "$NUGET_PACKAGES" + +# Disable first run since we want to control all package sources +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + # Restore the build scripts echo "Restoring Build Script projects..." (