Skip to content

Remove DOTNET_MULTILEVEL_LOOKUP environment variable settings - #3612

Merged
ViktorHofer merged 22 commits into
mainfrom
copilot/remove-dotnet-multilevel-lookup
Dec 2, 2025
Merged

ViktorHofer merged 22 commits into
mainfrom
copilot/remove-dotnet-multilevel-lookup

Conversation

Copilot AI commented Dec 1, 2025 •

Copy link
Copy Markdown
Contributor

Plan to Remove DOTNET_MULTILEVEL_LOOKUP Environment Variable

  • Analyze all occurrences of DOTNET_MULTILEVEL_LOOKUP in the repository (found 202 occurrences in ~125 files)
  • Categorize files by type:
    • Shell scripts (.sh)
    • PowerShell scripts (.ps1)
    • Batch/CMD scripts (.cmd, .bat)
    • C# test files (.cs)
    • JSON configuration files (.json)
    • YAML files (.yml)
  • Remove environment variable setting code from submodules (excluding eng/common files per feedback)
  • Remove environment variable setting from activation scripts (activate.sh, activate.ps1)
  • Remove environment variable setting from dev scripts (start-vs.cmd, dotnet.cmd, etc.)
  • Remove environment variable setting from test helper C# files (except runtime test utilities per feedback)
  • Remove environment variable setting from JSON devcontainer files
  • Remove environment variable setting from YAML pipeline files (except nuget-client per feedback)
  • Remove environment variable references from C# EnvironmentVariableFilter
  • Remove comments/documentation referencing DOTNET_MULTILEVEL_LOOKUP
  • Remove orphaned comments that described DOTNET_MULTILEVEL_LOOKUP purpose (except in reverted files)
  • Keep changes in src/arcade/eng/common per feedback
  • Revert changes to runtime test utilities (CommandExtensions.cs and Constants.cs) per feedback
  • Revert changes to eng/common and src/*/eng/common (except src/arcade/eng/common) per feedback
  • Revert changes to nuget-client pipeline YAML per feedback
  • Remove extra blank lines in arcade eng/common files
  • Remove additional orphaned comments in startvscode files
  • Remove orphaned comments from dotnet wrapper scripts (dotnet.cmd, dotnet.sh)
  • Remove extra blank lines from dotnet wrapper scripts
  • Remove orphaned .NET Core comments and preceding blank lines from start scripts
  • Remove orphaned .NET Core comments from PowerShell files (razor/startvs.ps1, runtime/eng/build.ps1)
  • Fix trailing commas in JSON devcontainer files
  • Remove orphaned "Don't use a globally installed SDK" comments from RunnerTemplate files
  • Run code review - passed with no issues
  • Run security scan - passed with no issues
  • Final validation complete

Summary

Successfully removed DOTNET_MULTILEVEL_LOOKUP environment variable settings from the repository (with scope adjustments per feedback):

  • Kept changes in: src/arcade/eng/common (arcade build infrastructure)
  • Reverted changes in:
    • eng/common and all src/*/eng/common except arcade (per feedback that these are synced from arcade)
    • runtime test utilities (CommandExtensions.cs, Constants.cs) to preserve test infrastructure
    • nuget-client pipeline YAML to preserve required build configuration
  • Modified 73 files (after reverts)
  • Removed lines setting DOTNET_MULTILEVEL_LOOKUP from non-eng/common locations
  • Preserved test code that needs to control this variable for testing purposes
  • Preserved nuget-client pipeline configuration that requires DOTNET_MULTILEVEL_LOOKUP
  • Fixed formatting: removed extra blank lines in arcade eng/common files and dotnet wrapper scripts
  • Removed all orphaned comments describing DOTNET_MULTILEVEL_LOOKUP (including .NET Core variant)
  • Fixed JSON syntax: removed trailing commas in devcontainer.json files
  • No security vulnerabilities introduced

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@dotnet-policy-service
dotnet-policy-service Bot requested review from a team December 1, 2025 20:01
@dotnet-policy-service
dotnet-policy-service Bot requested review from a team December 1, 2025 20:01
Copilot AI changed the title [WIP] Remove code setting DOTNET_MULTILEVEL_LOOKUP environment variable Remove DOTNET_MULTILEVEL_LOOKUP environment variable settings Dec 1, 2025
Copilot AI requested a review from jkotas December 1, 2025 20:05
Comment thread src/arcade/eng/common/tools.ps1 Resolved
Comment thread src/arcade/eng/common/tools.sh Resolved
Comment thread src/aspnetcore/activate.ps1 Resolved
Comment thread src/vstest/scripts/test.ps1 Resolved
@jkotas jkotas changed the title Remove DOTNET_MULTILEVEL_LOOKUP environment variable settings from src/arcade Remove DOTNET_MULTILEVEL_LOOKUP environment variable settings Dec 2, 2025
@jkotas
jkotas marked this pull request as ready for review December 2, 2025 00:13
Copilot AI review requested due to automatic review settings December 2, 2025 00:13
@jkotas

jkotas commented Dec 2, 2025

Copy link
Copy Markdown
Member

@jkoritzinsky This is ready for review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR systematically removes the DOTNET_MULTILEVEL_LOOKUP environment variable settings across the .NET repository. The variable was previously used to prevent .NET from searching for SDKs and runtimes in global locations (like Program Files), ensuring build determinism by forcing use of locally installed .NET tooling.

Key Changes:

  • Removed environment variable assignments from all build and developer workflow scripts
  • Cleaned up test utilities that previously set this variable for test isolation
  • Updated activation/deactivation scripts to no longer manage this variable
  • Removed the variable from environment filter lists in SDK tasks

Reviewed changes

Copilot reviewed 72 out of 72 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/wpf/start-vs.cmd Removed environment variable setting from VS launch script
src/wpf/eng/copy-wpf.ps1 Updated comment to remove reference; removed variable assignment
src/winforms/start-vs.cmd Removed environment variable setting from VS launch script
src/winforms/start-code.cmd Removed environment variable setting from VS Code launch script
src/vstest/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs Removed variable from test execution environment
src/vstest/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetHostArchitectureVerifierTests.cs Removed variable from test environment dictionaries
src/vstest/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.cs Removed variable from multiple test environment configurations
src/vstest/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetArchitectureSwitchTests.Windows.cs Removed variable from Windows-specific architecture tests
src/vstest/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Build.cs Removed variable from test environment setup
src/vstest/scripts/test.ps1 Removed variable assignment from test script
src/sourcelink/.devcontainer/devcontainer.json Removed variable from dev container configuration
src/source-build-reference-packages/test.sh Removed export statement
src/source-build-reference-packages/src/externalPackages/src/vs-solutionpersistence/tools/Install-DotNetSdk.ps1 Removed variable from environment setup
src/source-build-reference-packages/build.sh Removed export statement
src/sdk/test/Microsoft.NET.TestFramework/TestContext.cs Removed variable from test environment setup in two locations
src/sdk/src/Tasks/sdk-tasks/EnvironmentVariableFilter.cs Removed variable from environment filter whitelist
src/sdk/eng/restore-toolset.sh Removed variable from generated build environment script
src/sdk/eng/restore-toolset.ps1 Removed variable from generated build environment scripts (both .bat and .ps1)
src/sdk/build/RunTestsOnHelix.cmd Removed variable setting from Helix test script
src/sdk/.devcontainer/devcontainer.json Removed variable from dev container configuration
src/runtime/src/mono/wasm/Wasm.Build.Tests/Common/ToolCommand.cs Removed variable from process environment setup
src/runtime/src/mono/wasm/Wasm.Build.Tests/Common/RunCommand.cs Removed variable initialization
src/runtime/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs Removed variable from environment dictionary
src/runtime/src/libraries/System.Net.Http/tests/StressTests/HttpStress/load-corefx-testhost.ps1 Removed variable from SDK environment setup
src/runtime/src/libraries/Common/tests/System/Net/StressTests/build-local.sh Removed export statement
src/runtime/src/libraries/Common/tests/System/Net/StressTests/build-local.ps1 Removed variable assignment
src/runtime/eng/testing/RunnerTemplate.sh Removed variable export and associated comment
src/runtime/eng/testing/RunnerTemplate.cmd Removed variable setting and associated comment
src/runtime/eng/pipelines/common/macos-sign-with-entitlements.yml Removed variable from pipeline environment
src/runtime/eng/build.ps1 Removed variable setting and associated comment from VS launch setup
src/runtime/dotnet.sh Removed export and associated comment
src/runtime/dotnet.cmd Removed variable setting and associated comment
src/runtime/.devcontainer/wasm/devcontainer.json Removed variable from dev container, cleaned up trailing commas
src/runtime/.devcontainer/wasm-multiThreaded/devcontainer.json Removed variable from dev container, cleaned up trailing commas
src/runtime/.devcontainer/libraries/devcontainer.json Removed variable from dev container
src/runtime/.devcontainer/devcontainer.json Removed variable from dev container
src/runtime/.devcontainer/android/devcontainer.json Removed variable from dev container
src/razor/startvs.ps1 Removed variable setting and associated comment
src/razor/start-code.cmd Removed variable setting and associated comment
src/razor/activate.sh Removed variable export, unset, and associated comments
src/razor/activate.ps1 Removed variable setting, removal, and associated comments
src/nuget-client/test/NuGet.Core.FuncTests/Msbuild.Integration.Test/MsbuildIntegrationTestFixture.cs Removed variable from test environment
src/nuget-client/test/NuGet.Core.FuncTests/Dotnet.Integration.Test/DotnetIntegrationTestFixture.cs Removed variable from command execution environment
src/nuget-client/scripts/perftests/PerformanceTestUtilities.ps1 Removed variable assignment and cleanup
src/nuget-client/configure.sh Removed export and pipeline variable setting
src/nuget-client/configure.cmd Removed variable setting
src/nuget-client/build/common.ps1 Removed pipeline and local variable settings
src/msbuild/eng/restore-toolset.sh Removed variable from generated build environment script
src/msbuild/eng/restore-toolset.ps1 Removed variable from generated build environment scripts
src/fsharp/start-vs-FsharpSln.cmd Removed variable setting and associated comment
src/efcore/startvs.cmd Removed variable setting and associated comment
src/efcore/activate.sh Removed variable export, unset, and associated comments
src/efcore/activate.ps1 Removed variable setting, removal, and associated comments
src/diagnostics/start-vscode.sh Removed export and associated comment
src/diagnostics/src/tests/CommonTestRunner/TestRunner.cs Removed variable from process runner environment
src/diagnostics/src/SOS/SOS.UnitTests/SOSRunner.cs Removed variable from process runner environment (2 locations)
src/diagnostics/src/Microsoft.Diagnostics.TestHelpers/DotNetBuildDebuggeeTestStep.cs Removed variable from build and restore runners
src/diagnostics/dotnet.sh Removed export and associated comment
src/diagnostics/dotnet.cmd Removed variable setting and associated comment
src/diagnostics/.devcontainer/devcontainer.json Removed variable from dev container
src/aspnetcore/startvscode.sh Removed export and associated comment
src/aspnetcore/startvscode.cmd Removed variable setting and associated comment
src/aspnetcore/startvs.cmd Removed variable setting and associated comment
src/aspnetcore/src/submodules/MessagePack-CSharp/tools/Install-DotNetSdk.ps1 Removed variable from environment setup
src/aspnetcore/src/ProjectTemplates/scripts/startvs.cmd Removed variable setting and associated comment
src/aspnetcore/eng/helix/content/runtests.sh Removed export and associated comment
src/aspnetcore/eng/helix/content/runtests.cmd Removed variable setting
src/aspnetcore/activate.sh Removed variable export, unset, and associated comments
src/aspnetcore/activate.ps1 Removed variable setting, removal, and associated comments
src/aspnetcore/.devcontainer/devcontainer.json Removed variable from dev container
src/arcade/eng/common/tools.sh Removed export, pipeline variable setting, and associated comments
src/arcade/eng/common/tools.ps1 Removed variable setting, pipeline variable setting, and associated comments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team December 2, 2025 11:46
@ViktorHofer

Copy link
Copy Markdown
Member

Just let me know if you want this merged. I can merge over the currently failing validation job.

@jkotas

jkotas commented Dec 2, 2025

Copy link
Copy Markdown
Member

@ViktorHofer It would be great if you can merge this. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants