Ensure that the nuget config file is created. 67/274167/1
authorWonyoung Choi <wy80.choi@samsung.com>
Thu, 21 Apr 2022 04:28:57 +0000 (13:28 +0900)
committerWonyoung Choi <wy80.choi@samsung.com>
Fri, 22 Apr 2022 09:43:21 +0000 (18:43 +0900)
Change-Id: Ibc22df54604117f1d95e9ec3f9d0d868a195ab63

tools/dotnet-wrapper.sh

index 1babad0..1e19ec0 100755 (executable)
@@ -11,9 +11,13 @@ export MSBUILDDISABLENODEREUSE=true
 # 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.