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()
97
97
return envVarPath ;
98
98
}
99
99
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
+
100
109
var nugetExesInRepo = fileProvider . NugetExes ;
101
110
if ( nugetExesInRepo . Count > 1 )
102
111
{
@@ -119,7 +128,7 @@ private string ResolveNugetExe()
119
128
return nugetPath ;
120
129
}
121
130
122
- return DownloadNugetExe ( fileProvider . SourceDir . FullName ) ;
131
+ throw new Exception ( "Could not find or download nuget.exe." ) ;
123
132
}
124
133
125
134
private string DownloadNugetExe ( string sourceDir )
@@ -136,17 +145,9 @@ private string DownloadNugetExe(string sourceDir)
136
145
137
146
Directory . CreateDirectory ( directory ) ;
138
147
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 ;
150
151
}
151
152
152
153
private bool RunWithMono => ! Win32 . IsWindows ( ) && ! string . IsNullOrEmpty ( Path . GetExtension ( nugetExe ) ) ;
You can’t perform that action at this time.
0 commit comments