@@ -96,6 +96,7 @@ private List<string> GetReachableFallbackNugetFeeds()
9696 if ( fallbackFeeds . Count == 0 )
9797 {
9898 fallbackFeeds . Add ( PublicNugetFeed ) ;
99+ logger . LogInfo ( $ "No fallback Nuget feeds specified. Using default feed: { PublicNugetFeed } ") ;
99100 }
100101
101102 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
188189 var reachableFallbackFeeds = GetReachableFallbackNugetFeeds ( ) ;
189190 if ( reachableFallbackFeeds . Count > 0 )
190191 {
191- DownloadMissingPackages ( allNonBinaryFiles , dllLocations , withNugetConfigFromSrc : false , fallbackNugetFeeds : reachableFallbackFeeds ) ;
192+ DownloadMissingPackages ( allNonBinaryFiles , dllLocations , fallbackNugetFeeds : reachableFallbackFeeds ) ;
192193 }
193194 else
194195 {
195196 logger . LogWarning ( "Skipping download of missing packages from specific feeds as no fallback Nuget feeds are reachable." ) ;
196197 }
197198 }
198199
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 )
200201 {
201202 var alreadyDownloadedPackages = GetRestoredPackageDirectoryNames ( packageDirectory . DirInfo ) ;
202203 var alreadyDownloadedLegacyPackages = GetRestoredLegacyPackageNames ( ) ;
@@ -230,7 +231,7 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, HashSet<AssemblyLo
230231
231232 logger . LogInfo ( $ "Found { notYetDownloadedPackages . Count } packages that are not yet restored") ;
232233 using var tempDir = new TemporaryDirectory ( ComputeTempDirectory ( sourceDir . FullName , "nugetconfig" ) ) ;
233- var nugetConfig = withNugetConfigFromSrc
234+ var nugetConfig = fallbackNugetFeeds is null
234235 ? GetNugetConfig ( allFiles )
235236 : CreateFallbackNugetConfig ( fallbackNugetFeeds , tempDir . DirInfo . FullName ) ;
236237
@@ -241,7 +242,7 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, HashSet<AssemblyLo
241242
242243 Parallel . ForEach ( notYetDownloadedPackages , new ParallelOptions { MaxDegreeOfParallelism = threads } , package =>
243244 {
244- var success = TryRestorePackageManually ( package . Name , nugetConfig , package . PackageReferenceSource , tryWithoutNugetConfig : withNugetConfigFromSrc ) ;
245+ var success = TryRestorePackageManually ( package . Name , nugetConfig , package . PackageReferenceSource , tryWithoutNugetConfig : fallbackNugetFeeds is null ) ;
245246 if ( ! success )
246247 {
247248 return ;
@@ -258,15 +259,8 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, HashSet<AssemblyLo
258259 dllLocations . Add ( missingPackageDirectory . DirInfo . FullName ) ;
259260 }
260261
261- private string ? CreateFallbackNugetConfig ( IEnumerable < string > ? fallbackNugetFeeds , string folderPath )
262+ private string ? CreateFallbackNugetConfig ( IEnumerable < string > fallbackNugetFeeds , string folderPath )
262263 {
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-
270264 var sb = new StringBuilder ( ) ;
271265 fallbackNugetFeeds . ForEach ( ( feed , index ) => sb . AppendLine ( $ "<add key=\" feed{ index } \" value=\" { feed } \" />") ) ;
272266
@@ -587,19 +581,11 @@ private IEnumerable<string> GetFeeds(Func<IList<string>> getNugetFeeds)
587581 }
588582 }
589583
590- private ( HashSet < string > , HashSet < string > ) GetAllFeeds ( List < FileInfo > allFiles )
584+ private ( HashSet < string > explicitFeeds , HashSet < string > allFeeds ) GetAllFeeds ( List < FileInfo > allFiles )
591585 {
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 ) ;
597587
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 ) ;
603589
604590 var nugetConfigs = GetAllNugetConfigs ( allFiles ) ;
605591 var explicitFeeds = nugetConfigs
0 commit comments