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