diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs index 618eb5444a1b..e6cb9dec582c 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs @@ -16,7 +16,7 @@ namespace Microsoft.DotNet.Cli.Utils internal class MSBuildForwardingAppWithoutLogging { private static readonly bool AlwaysExecuteMSBuildOutOfProc = Env.GetEnvironmentVariableAsBool("DOTNET_CLI_RUN_MSBUILD_OUTOFPROC"); - private static readonly bool UseMSBUILDNOINPROCNODE = Env.GetEnvironmentVariableAsBool("DOTNET_CLI_USE_MSBUILDNOINPROCNODE"); + private static readonly bool UseMSBuildServer = !Env.GetEnvironmentVariableAsBool("DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER"); private const string MSBuildExeName = "MSBuild.dll"; @@ -54,12 +54,7 @@ public MSBuildForwardingAppWithoutLogging(IEnumerable argsToForward, str _argsToForward = argsToForward; MSBuildPath = msbuildPath ?? defaultMSBuildPath; - if (UseMSBUILDNOINPROCNODE) - { - // Force MSBuild to use external working node long living process for building projects - // We also refers to this as MSBuild Server V1 as entry process forwards most of the work to it. - EnvironmentVariable("MSBUILDNOINPROCNODE", "1"); - } + EnvironmentVariable("MSBUILDUSESERVER", UseMSBuildServer ? "1" : "0"); // If DOTNET_CLI_RUN_MSBUILD_OUTOFPROC is set or we're asked to execute a non-default binary, call MSBuild out-of-proc. if (AlwaysExecuteMSBuildOutOfProc || !string.Equals(MSBuildPath, defaultMSBuildPath, StringComparison.OrdinalIgnoreCase)) @@ -100,8 +95,9 @@ public void EnvironmentVariable(string name, string value) if (value == string.Empty || value == "\0") { - // Do not allow MSBuild NOIPROCNODE as null env vars are not properly transferred to build nodes - _msbuildRequiredEnvironmentVariables["MSBUILDNOINPROCNODE"] = "0"; + // Do not allow MSBUILDUSESERVER as null env vars are not properly transferred to build nodes + _msbuildRequiredEnvironmentVariables["MSBUILDUSESERVER"] = "0"; + // Unlike ProcessStartInfo.EnvironmentVariables, Environment.SetEnvironmentVariable can't set a variable // to an empty value, so we just fall back to calling MSBuild out-of-proc if we encounter this case. // https://github.com/dotnet/runtime/issues/50554 diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ResolveTargetingPackAssets.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ResolveTargetingPackAssets.cs index 62378e641719..8160a930399d 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ResolveTargetingPackAssets.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ResolveTargetingPackAssets.cs @@ -621,7 +621,7 @@ public RuntimeFramework(string name, string frameworkName, ITaskItem item) public string CacheKey() { - return $"{nameof(RuntimeFramework)}: {Name} ({FrameworkName})"; + return $"{nameof(RuntimeFramework)}: {Name} ({FrameworkName} {Item?.GetMetadata(MetadataKeys.Version)})"; } }