From 90d62fd10d3cc4fadff5c41527606de7d884c8bc Mon Sep 17 00:00:00 2001 From: Wonyoung Choi Date: Wed, 20 Apr 2022 15:05:24 +0900 Subject: [PATCH] Use /nuget as a default nuget source instead of nuget.org Change-Id: Ib2c3b48c2b6d1a045c93dd3e9a7f471a6c9c6585 --- tools/dotnet-wrapper.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/dotnet-wrapper.sh b/tools/dotnet-wrapper.sh index 150be979..1babad08 100755 --- a/tools/dotnet-wrapper.sh +++ b/tools/dotnet-wrapper.sh @@ -7,13 +7,25 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true export DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2 export MSBUILDDISABLENODEREUSE=true +# Use /nuget as a default source for NuGet packages instead of the nuget.org. +# The public NuGet repository can not be used in GBS builds because of the network access. +NUGET_CONFIG_FILE=$HOME/.nuget/NuGet/NuGet.Config +if [ ! -f "$HOME/.nuget_config_fixed" ]; then + $DOTNET_CLI_PATH nuget disable source nuget.org --configfile $NUGET_CONFIG_FILE + $DOTNET_CLI_PATH nuget add source -n local /nuget --configfile $NUGET_CONFIG_FILE + touch $HOME/.nuget_config_fixed 2>/dev/null || true +fi + +# This is a workaround for the relative path issue in dotnet-cli. +# https://github.com/NuGet/Home/issues/9406 CMD=$1; shift ARGS=("$@") + if [ "$CMD" == "msbuild" -o "$CMD" == "build" -o "$CMD" == "restore" ] ; then ARGS+=(/nodeReuse:false /p:UseSharedCompilation=false) - # clear nuget packages folder + # Clear nuget cache for each project build. if [ ! -f ".nuget_cache_cleared" ]; then $DOTNET_CLI_PATH nuget locals all --clear touch .nuget_cache_cleared 2>/dev/null || true -- 2.34.1