@@ -96,6 +96,7 @@ private List<string> GetReachableFallbackNugetFeeds()
96
96
if ( fallbackFeeds . Count == 0 )
97
97
{
98
98
fallbackFeeds . Add ( PublicNugetFeed ) ;
99
+ logger . LogInfo ( $ "No fallback Nuget feeds specified. Using default feed: { PublicNugetFeed } ") ;
99
100
}
100
101
101
102
logger . LogInfo ( $ "Checking fallback Nuget feed reachability on feeds: { string . Join ( ", " , fallbackFeeds . OrderBy ( f => f ) ) } ") ;
@@ -188,15 +189,15 @@ private void DownloadMissingPackagesFromSpecificFeeds(List<FileInfo> allNonBinar
188
189
var reachableFallbackFeeds = GetReachableFallbackNugetFeeds ( ) ;
189
190
if ( reachableFallbackFeeds . Count > 0 )
190
191
{
191
- DownloadMissingPackages ( allNonBinaryFiles , dllLocations , withNugetConfigFromSrc : false , fallbackNugetFeeds : reachableFallbackFeeds ) ;
192
+ DownloadMissingPackages ( allNonBinaryFiles , dllLocations , fallbackNugetFeeds : reachableFallbackFeeds ) ;
192
193
}
193
194
else
194
195
{
195
196
logger . LogWarning ( "Skipping download of missing packages from specific feeds as no fallback Nuget feeds are reachable." ) ;
196
197
}
197
198
}
198
199
199
- private void DownloadMissingPackages ( List < FileInfo > allFiles , HashSet < AssemblyLookupLocation > dllLocations , bool withNugetConfigFromSrc = true , IEnumerable < string > ? fallbackNugetFeeds = null )
200
+ private void DownloadMissingPackages ( List < FileInfo > allFiles , HashSet < AssemblyLookupLocation > dllLocations , IEnumerable < string > ? fallbackNugetFeeds = null )
200
201
{
201
202
var alreadyDownloadedPackages = GetRestoredPackageDirectoryNames ( packageDirectory . DirInfo ) ;
202
203
var alreadyDownloadedLegacyPackages = GetRestoredLegacyPackageNames ( ) ;
@@ -230,7 +231,7 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, HashSet<AssemblyLo
230
231
231
232
logger . LogInfo ( $ "Found { notYetDownloadedPackages . Count } packages that are not yet restored") ;
232
233
using var tempDir = new TemporaryDirectory ( ComputeTempDirectory ( sourceDir . FullName , "nugetconfig" ) ) ;
233
- var nugetConfig = withNugetConfigFromSrc
234
+ var nugetConfig = fallbackNugetFeeds is null
234
235
? GetNugetConfig ( allFiles )
235
236
: CreateFallbackNugetConfig ( fallbackNugetFeeds , tempDir . DirInfo . FullName ) ;
236
237
@@ -241,7 +242,7 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, HashSet<AssemblyLo
241
242
242
243
Parallel . ForEach ( notYetDownloadedPackages , new ParallelOptions { MaxDegreeOfParallelism = threads } , package =>
243
244
{
244
- var success = TryRestorePackageManually ( package . Name , nugetConfig , package . PackageReferenceSource , tryWithoutNugetConfig : withNugetConfigFromSrc ) ;
245
+ var success = TryRestorePackageManually ( package . Name , nugetConfig , package . PackageReferenceSource , tryWithoutNugetConfig : fallbackNugetFeeds is null ) ;
245
246
if ( ! success )
246
247
{
247
248
return ;
@@ -258,15 +259,8 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, HashSet<AssemblyLo
258
259
dllLocations . Add ( missingPackageDirectory . DirInfo . FullName ) ;
259
260
}
260
261
261
- private string ? CreateFallbackNugetConfig ( IEnumerable < string > ? fallbackNugetFeeds , string folderPath )
262
+ private string ? CreateFallbackNugetConfig ( IEnumerable < string > fallbackNugetFeeds , string folderPath )
262
263
{
263
- if ( fallbackNugetFeeds is null )
264
- {
265
- // We're not overriding the inherited Nuget feeds
266
- logger . LogInfo ( "No fallback Nuget feeds provided. Not creating a fallback nuget.config file." ) ;
267
- return null ;
268
- }
269
-
270
264
var sb = new StringBuilder ( ) ;
271
265
fallbackNugetFeeds . ForEach ( ( feed , index ) => sb . AppendLine ( $ "<add key=\" feed{ index } \" value=\" { feed } \" />") ) ;
272
266
@@ -587,19 +581,11 @@ private IEnumerable<string> GetFeeds(Func<IList<string>> getNugetFeeds)
587
581
}
588
582
}
589
583
590
- private ( HashSet < string > , HashSet < string > ) GetAllFeeds ( List < FileInfo > allFiles )
584
+ private ( HashSet < string > explicitFeeds , HashSet < string > allFeeds ) GetAllFeeds ( List < FileInfo > allFiles )
591
585
{
592
- IList < string > GetNugetFeeds ( string nugetConfig )
593
- {
594
- logger . LogInfo ( $ "Getting Nuget feeds from '{ nugetConfig } '...") ;
595
- return dotnet . GetNugetFeeds ( nugetConfig ) ;
596
- }
586
+ IList < string > GetNugetFeeds ( string nugetConfig ) => dotnet . GetNugetFeeds ( nugetConfig ) ;
597
587
598
- IList < string > GetNugetFeedsFromFolder ( string folderPath )
599
- {
600
- logger . LogInfo ( $ "Getting Nuget feeds in folder '{ folderPath } '...") ;
601
- return dotnet . GetNugetFeedsFromFolder ( folderPath ) ;
602
- }
588
+ IList < string > GetNugetFeedsFromFolder ( string folderPath ) => dotnet . GetNugetFeedsFromFolder ( folderPath ) ;
603
589
604
590
var nugetConfigs = GetAllNugetConfigs ( allFiles ) ;
605
591
var explicitFeeds = nugetConfigs
0 commit comments