Skip to content

Commit cdf1c26

Browse files
committed
C#: Only include CoreLib.dll when UseMscorlib option is set
1 parent bf3677d commit cdf1c26

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,6 @@ public BuildAnalysis(Options options, IProgressMonitor progress)
100100
dllDirNames.Add(runtimeLocation);
101101
}
102102

103-
if (options.UseMscorlib)
104-
{
105-
// Add mscorlib.dll or System.Private.CoreLib.dll to the list of DLLs to reference.
106-
var loc = typeof(object).Assembly.Location;
107-
var dir = Path.GetDirectoryName(loc);
108-
if (dir != null)
109-
{
110-
progressMonitor.Log(Util.Logging.Severity.Debug, $"Adding folder {dir} to DLL search path.");
111-
dllDirNames.Add(dir);
112-
}
113-
}
114-
115103
// These files can sometimes prevent `dotnet restore` from working correctly.
116104
using (new FileRenamer(sourceDir.GetFiles("global.json", SearchOption.AllDirectories)))
117105
using (new FileRenamer(sourceDir.GetFiles("Directory.Build.props", SearchOption.AllDirectories)))
@@ -132,6 +120,11 @@ public BuildAnalysis(Options options, IProgressMonitor progress)
132120
UseReference(filename);
133121
}
134122

123+
if (options.UseMscorlib)
124+
{
125+
UseReference(typeof(object).Assembly.Location);
126+
}
127+
135128
ResolveConflicts();
136129

137130
// Output the findings

0 commit comments

Comments
 (0)