File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed
Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,15 @@ private string ResolveNugetExe()
9797 return envVarPath ;
9898 }
9999
100+ try
101+ {
102+ return DownloadNugetExe ( fileProvider . SourceDir . FullName ) ;
103+ }
104+ catch ( Exception exc )
105+ {
106+ logger . LogInfo ( $ "Download of nuget.exe failed: { exc . Message } ") ;
107+ }
108+
100109 var nugetExesInRepo = fileProvider . NugetExes ;
101110 if ( nugetExesInRepo . Count > 1 )
102111 {
@@ -119,7 +128,7 @@ private string ResolveNugetExe()
119128 return nugetPath ;
120129 }
121130
122- return DownloadNugetExe ( fileProvider . SourceDir . FullName ) ;
131+ throw new Exception ( "Could not find or download nuget.exe." ) ;
123132 }
124133
125134 private string DownloadNugetExe ( string sourceDir )
@@ -136,17 +145,9 @@ private string DownloadNugetExe(string sourceDir)
136145
137146 Directory . CreateDirectory ( directory ) ;
138147 logger . LogInfo ( "Attempting to download nuget.exe" ) ;
139- try
140- {
141- FileUtils . DownloadFile ( FileUtils . NugetExeUrl , nuget ) ;
142- logger . LogInfo ( $ "Downloaded nuget.exe to { nuget } ") ;
143- return nuget ;
144- }
145- catch
146- {
147- // Download failed.
148- throw new FileNotFoundException ( "Download of nuget.exe failed." ) ;
149- }
148+ FileUtils . DownloadFile ( FileUtils . NugetExeUrl , nuget ) ;
149+ logger . LogInfo ( $ "Downloaded nuget.exe to { nuget } ") ;
150+ return nuget ;
150151 }
151152
152153 private bool RunWithMono => ! Win32 . IsWindows ( ) && ! string . IsNullOrEmpty ( Path . GetExtension ( nugetExe ) ) ;
You can’t perform that action at this time.
0 commit comments