Skip to content

Commit 9eae946

Browse files
authored
Merge pull request github#13659 from tamasvajk/standalone-minor-fixes
C#: Minor fixes in standalone extraction
2 parents 5ea929d + ffc09c4 commit 9eae946

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

csharp/extractor/Semmle.Extraction.CSharp.Standalone/AssemblyCache.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ private void AddReferenceDirectory(string dir)
4141
}
4242
}
4343

44+
private static readonly Version emptyVersion = new Version(0, 0, 0, 0);
45+
4446
/// <summary>
4547
/// Indexes all DLLs we have located.
4648
/// Because this is a potentially time-consuming operation, it is put into a separate stage.
@@ -55,7 +57,9 @@ private void IndexReferences()
5557

5658
// Index "assemblyInfo" by version string
5759
// The OrderBy is used to ensure that we by default select the highest version number.
58-
foreach (var info in assemblyInfoByFileName.Values.OrderBy(info => info.Id))
60+
foreach (var info in assemblyInfoByFileName.Values
61+
.OrderBy(info => info.Name)
62+
.ThenBy(info => info.Version ?? emptyVersion))
5963
{
6064
foreach (var index in info.IndexStrings)
6165
assemblyInfoById[index] = info;

csharp/extractor/Semmle.Extraction.CSharp/Extractor/CsProjFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private static (string[] csFiles, string[] references, string[] projectReference
100100

101101
// Figure out if it's dotnet core
102102

103-
var netCoreProjectFile = root.GetAttribute("Sdk") == "Microsoft.NET.Sdk";
103+
var netCoreProjectFile = root.GetAttribute("Sdk").StartsWith("Microsoft.NET.Sdk");
104104

105105
if (netCoreProjectFile)
106106
{

0 commit comments

Comments
 (0)