@@ -62,7 +62,7 @@ private void GenerateUsageReport()
62
62
{
63
63
PackageInfo [ ] existingSbrps = [ .. _sbrpPackages . Values . OrderBy ( pkg => pkg . Id ) ] ;
64
64
PurgeNonReferencedReferences ( ) ;
65
- IEnumerable < string > unreferencedSbrps = GetUnreferencedSbrps ( ) . Select ( pkg => pkg . Id ) . OrderBy ( id => id ) ;
65
+ IEnumerable < string > unreferencedSbrps = GetUnreferencedSbrps ( ) . Select ( pkg => pkg . Path ) . OrderBy ( id => id ) ;
66
66
Report report = new ( existingSbrps , unreferencedSbrps ) ;
67
67
68
68
string reportFilePath = Path . Combine ( OutputPath , "sbrpPackageUsage.json" ) ;
@@ -151,7 +151,7 @@ private void ScanProjectReferences()
151
151
LockFile lockFile = new LockFileFormat ( ) . Read ( projectJsonFile ) ;
152
152
foreach ( LockFileTargetLibrary lib in lockFile . Targets . SelectMany ( t => t . Libraries ) )
153
153
{
154
- if ( ! _sbrpPackages . TryGetValue ( $ " { lib . Name } / { lib . Version } " , out PackageInfo ? info ) )
154
+ if ( ! _sbrpPackages . TryGetValue ( PackageInfo . GetId ( lib . Name , lib . Version ? . ToString ( ) ) , out PackageInfo ? info ) )
155
155
{
156
156
continue ;
157
157
}
@@ -175,10 +175,12 @@ private void ScanProjectReferences()
175
175
176
176
private record PackageInfo ( string Name , string Version , string Path , HashSet < string > ? Tfms = default )
177
177
{
178
- public string Id => $ " { Name } / { Version } " ;
178
+ public string Id => GetId ( Name , Version ) ;
179
179
180
180
// Dictionary of projects referencing the SBRP and the TFMs referenced by each project
181
181
public Dictionary < string , HashSet < string > > References { get ; } = [ ] ;
182
+
183
+ public static string GetId ( string ? Name , string ? Version ) => $ "{ Name ? . ToLowerInvariant ( ) } /{ Version } ";
182
184
}
183
185
184
186
private record Report ( IEnumerable < PackageInfo > Sbrps , IEnumerable < string > UnreferencedSbrps ) ;
0 commit comments