@@ -24,6 +24,7 @@ public sealed class DependencyManager : IDisposable
24
24
private readonly IDictionary < string , string > unresolvedReferences = new ConcurrentDictionary < string , string > ( ) ;
25
25
private readonly List < string > nonGeneratedSources ;
26
26
private readonly List < string > generatedSources ;
27
+ private int dotnetFrameworkVersionVariantCount = 0 ;
27
28
private int conflictedReferences = 0 ;
28
29
private readonly IDependencyOptions options ;
29
30
private readonly DirectoryInfo sourceDir ;
@@ -123,15 +124,15 @@ public DependencyManager(string srcDir, IDependencyOptions options, ILogger logg
123
124
const int align = 6 ;
124
125
logger . LogInfo ( "" ) ;
125
126
logger . LogInfo ( "Build analysis summary:" ) ;
126
- logger . LogInfo ( $ "{ this . nonGeneratedSources . Count , align } source files in the filesystem") ;
127
- logger . LogInfo ( $ "{ this . generatedSources . Count , align } generated source files") ;
127
+ logger . LogInfo ( $ "{ nonGeneratedSources . Count , align } source files in the filesystem") ;
128
+ logger . LogInfo ( $ "{ generatedSources . Count , align } generated source files") ;
128
129
logger . LogInfo ( $ "{ allSolutions . Count , align } solution files") ;
129
130
logger . LogInfo ( $ "{ allProjects . Count , align } project files in the filesystem") ;
130
131
logger . LogInfo ( $ "{ usedReferences . Keys . Count , align } resolved references") ;
131
132
logger . LogInfo ( $ "{ unresolvedReferences . Count , align } unresolved references") ;
132
133
logger . LogInfo ( $ "{ conflictedReferences , align } resolved assembly conflicts") ;
134
+ logger . LogInfo ( $ "{ dotnetFrameworkVersionVariantCount , align } restored .NET framework variants") ;
133
135
logger . LogInfo ( $ "Build analysis completed in { DateTime . Now - startTime } ") ;
134
-
135
136
}
136
137
137
138
private HashSet < string > AddFrameworkDlls ( HashSet < string > dllPaths )
@@ -241,11 +242,7 @@ private void RemoveNugetAnalyzerReferences()
241
242
242
243
private void SelectNewestFrameworkPath ( string frameworkPath , string frameworkType , ISet < string > dllPaths , ISet < string > frameworkLocations )
243
244
{
244
- var versionFolders = new DirectoryInfo ( frameworkPath )
245
- . EnumerateDirectories ( "*" , new EnumerationOptions { MatchCasing = MatchCasing . CaseInsensitive , RecurseSubdirectories = false } )
246
- . OrderByDescending ( d => d . Name ) // TODO: Improve sorting to handle pre-release versions.
247
- . ToArray ( ) ;
248
-
245
+ var versionFolders = GetPackageVersionSubDirectories ( frameworkPath ) ;
249
246
if ( versionFolders . Length > 1 )
250
247
{
251
248
var versions = string . Join ( ", " , versionFolders . Select ( d => d . Name ) ) ;
@@ -264,18 +261,34 @@ private void SelectNewestFrameworkPath(string frameworkPath, string frameworkTyp
264
261
logger . LogInfo ( $ "Found { frameworkType } DLLs in NuGet packages at { selectedFrameworkFolder } .") ;
265
262
}
266
263
264
+ private static DirectoryInfo [ ] GetPackageVersionSubDirectories ( string packagePath )
265
+ {
266
+ return new DirectoryInfo ( packagePath )
267
+ . EnumerateDirectories ( "*" , new EnumerationOptions { MatchCasing = MatchCasing . CaseInsensitive , RecurseSubdirectories = false } )
268
+ . OrderByDescending ( d => d . Name ) // TODO: Improve sorting to handle pre-release versions.
269
+ . ToArray ( ) ;
270
+ }
271
+
267
272
private void AddNetFrameworkDlls ( ISet < string > dllPaths , ISet < string > frameworkLocations )
268
273
{
269
274
// Multiple dotnet framework packages could be present.
270
275
// The order of the packages is important, we're adding the first one that is present in the nuget cache.
271
276
var packagesInPrioOrder = FrameworkPackageNames . NetFrameworks ;
272
277
273
- var frameworkPath = packagesInPrioOrder
278
+ var frameworkPaths = packagesInPrioOrder
274
279
. Select ( ( s , index ) => ( Index : index , Path : GetPackageDirectory ( s ) ) )
275
- . FirstOrDefault ( pair => pair . Path is not null ) ;
280
+ . Where ( pair => pair . Path is not null )
281
+ . ToArray ( ) ;
282
+
283
+ var frameworkPath = frameworkPaths . FirstOrDefault ( ) ;
276
284
277
285
if ( frameworkPath . Path is not null )
278
286
{
287
+ foreach ( var fp in frameworkPaths )
288
+ {
289
+ dotnetFrameworkVersionVariantCount += GetPackageVersionSubDirectories ( fp . Path ! ) . Length ;
290
+ }
291
+
279
292
SelectNewestFrameworkPath ( frameworkPath . Path , ".NET Framework" , dllPaths , frameworkLocations ) ;
280
293
281
294
for ( var i = frameworkPath . Index + 1 ; i < packagesInPrioOrder . Length ; i ++ )
0 commit comments