@@ -30,6 +30,8 @@ internal sealed partial class BuildAnalysis : IDisposable
30
30
private readonly DirectoryInfo sourceDir ;
31
31
private readonly DotNet dotnet ;
32
32
private readonly Lazy < IEnumerable < string > > allFiles ;
33
+ private readonly TemporaryDirectory packageDirectory ;
34
+
33
35
34
36
/// <summary>
35
37
/// Performs a C# build analysis.
@@ -196,6 +198,7 @@ private void ResolveConflicts()
196
198
{
197
199
finalAssemblyList [ r . Name ] = r ;
198
200
}
201
+
199
202
// Update the used references list
200
203
usedReferences . Clear ( ) ;
201
204
foreach ( var r in finalAssemblyList . Select ( r => r . Value . Filename ) )
@@ -219,25 +222,23 @@ private void ResolveConflicts()
219
222
/// Store that a particular reference file is used.
220
223
/// </summary>
221
224
/// <param name="reference">The filename of the reference.</param>
222
- private void UseReference ( string reference ) =>
223
- usedReferences [ reference ] = true ;
225
+ private void UseReference ( string reference ) => usedReferences [ reference ] = true ;
224
226
225
227
/// <summary>
226
228
/// Store that a particular source file is used (by a project file).
227
229
/// </summary>
228
230
/// <param name="sourceFile">The source file.</param>
229
- private void UseSource ( FileInfo sourceFile ) =>
230
- sources [ sourceFile . FullName ] = sourceFile . Exists ;
231
+ private void UseSource ( FileInfo sourceFile ) => sources [ sourceFile . FullName ] = sourceFile . Exists ;
231
232
232
233
/// <summary>
233
234
/// All files in the source directory.
234
235
/// </summary>
235
- private IEnumerable < string > AllFiles => this . allFiles . Value ;
236
+ private IEnumerable < string > AllFiles => allFiles . Value ;
236
237
237
238
/// <summary>
238
239
/// The list of resolved reference files.
239
240
/// </summary>
240
- public IEnumerable < string > ReferenceFiles => this . usedReferences . Keys ;
241
+ public IEnumerable < string > ReferenceFiles => usedReferences . Keys ;
241
242
242
243
/// <summary>
243
244
/// The list of source files used in projects.
@@ -252,7 +253,7 @@ private void UseSource(FileInfo sourceFile) =>
252
253
/// <summary>
253
254
/// List of assembly IDs which couldn't be resolved.
254
255
/// </summary>
255
- public IEnumerable < string > UnresolvedReferences => this . unresolvedReferences . Select ( r => r . Key ) ;
256
+ public IEnumerable < string > UnresolvedReferences => unresolvedReferences . Select ( r => r . Key ) ;
256
257
257
258
/// <summary>
258
259
/// List of source files which were mentioned in project files but
@@ -266,10 +267,7 @@ private void UseSource(FileInfo sourceFile) =>
266
267
/// </summary>
267
268
/// <param name="id">The assembly ID.</param>
268
269
/// <param name="projectFile">The project file making the reference.</param>
269
- private void UnresolvedReference ( string id , string projectFile ) =>
270
- unresolvedReferences [ id ] = projectFile ;
271
-
272
- private readonly TemporaryDirectory packageDirectory ;
270
+ private void UnresolvedReference ( string id , string projectFile ) => unresolvedReferences [ id ] = projectFile ;
273
271
274
272
/// <summary>
275
273
/// Reads all the source files and references from the given list of projects.
@@ -368,11 +366,11 @@ private static bool IsGroupMatch(ReadOnlySpan<char> line, Regex regex, string gr
368
366
}
369
367
370
368
/// <summary>
371
- /// Returns true if the given project uses the ASP.NET components .
369
+ /// Returns true if any file in the source directory indicates that ASP.NET is used .
372
370
/// The following heuristic is used to decide, if ASP.NET is used:
373
- /// If any file in the project contains either of (this will most like be a .csproj file)
374
- /// <Project Sdk="Microsoft.NET.Sdk.Web" ...
375
- /// <FrameworkReference Include="Microsoft.AspNetCore.App" ...
371
+ /// If any file in the source directory contains something like (this will most like be a .csproj file)
372
+ /// <Project Sdk="Microsoft.NET.Sdk.Web">
373
+ /// <FrameworkReference Include="Microsoft.AspNetCore.App"/>
376
374
/// </summary>
377
375
private bool UseAspNetDlls ( )
378
376
{
@@ -488,8 +486,7 @@ private void AnalyseSolutions(IEnumerable<string> solutions)
488
486
} ) ;
489
487
}
490
488
491
- public void Dispose ( ) =>
492
- packageDirectory ? . Dispose ( ) ;
489
+ public void Dispose ( ) => packageDirectory ? . Dispose ( ) ;
493
490
494
491
[ GeneratedRegex ( "<PackageReference\\ s+Include=\" (.*?)\" .*/?>" , RegexOptions . IgnoreCase | RegexOptions . Compiled | RegexOptions . Singleline ) ]
495
492
private static partial Regex PackageReference ( ) ;
0 commit comments