[Breaking change]: Multi-level lookup behavior is being disabled #28836
Labels
binary incompatible
Existing binaries may encounter a breaking change in behavior.
breaking-change
Indicates a .NET Core breaking change
🏁 Release: .NET 7
Work items for the .NET 7 release
doc-idea
Indicates issues that are suggestions for new topics [org][type][category]
Pri1
High priority, do before Pri2 and Pri3
Description
On Windows, framework-dependent .NET applications would search for frameworks in multiple install locations by default. In .NET 7, this behavior is disabled.
Runtime change: dotnet/runtime#67022
Version
.NET 7 Preview 4
Previous behavior
A framework-dependent .NET application could search for frameworks in multiple install locations:
Subdirectories relative to:
dotnet
executable when running the application throughdotnet
DOTNET_ROOT
environment variable (if set) when running the application through its executable (apphost
)Globally registered install location (if set) in
HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\<arch>\InstallLocation
.Default install location of
%ProgramFiles%\dotnet
(or%ProgramFiles(x86)%\dotnet
for 32-bit processes on 64-bit Windows).This multi-level lookup behavior was enabled by default but could be disabled by setting the environment variable
DOTNET_MULTILEVEL_LOOKUP=0
.New behavior
An application targeting .NET 7 or above will only look in one location - the first location where a .NET installation is found. When running an application through
dotnet
, frameworks are only searched for in subdirectories relative todotnet
. When running an application through its executable (apphost
), frameworks are only searched for in the first of the locations listed in the previous behavior section where .NET is found.Applications targeting .NET 6 or below are unaffected.
Type of breaking change
Reason for change
There has been a lot of feedback around issues caused by multi-level lookup:
Recommended action
Make sure the required version of .NET is installed at the single .NET install location. Error messages on failure to launch include the expected location.
Feature area
Deployment
Affected APIs
No response
The text was updated successfully, but these errors were encountered: