# 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
+ # Ensure that the nuget config file is created.
+ $DOTNET_CLI_PATH nuget locals -l all
+ if [ -f $NUGET_CONFIG_FILE ]; 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
fi
# This is a workaround for the relative path issue in dotnet-cli.