C#: Add proper .NET environment for dotnet info and list-sdks and streamline the minimal dotnet environment.

This commit is contained in:
Michael Nebel
2025-11-18 16:31:09 +01:00
parent 0daee6fbf2
commit fba496f911
4 changed files with 26 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using Semmle.Util;
using Semmle.Util.Logging;
@@ -36,10 +37,12 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
{
startInfo.WorkingDirectory = workingDirectory;
}
// Set the .NET CLI language to English to avoid localized output.
startInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = "en";
startInfo.EnvironmentVariables["MSBUILDDISABLENODEREUSE"] = "1";
startInfo.EnvironmentVariables["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "true";
// Set minimal environment variables.
foreach (var kvp in IDotNetCliInvoker.MinimalEnvironment)
{
startInfo.EnvironmentVariables[kvp.Key] = kvp.Value;
}
// Configure the proxy settings, if applicable.
if (this.proxy != null)