dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.27k stars 4.73k forks source link

Enable lazy loading .NET "frameworks" #36576

Open richlander opened 4 years ago

richlander commented 4 years ago

It should be possible to write code that lights up when a given higher-level framework, like ASP.NET Core or Windows Desktop is available.

I ran into this with PowerShell. Some variants depend on Microsoft.WindowsDesktop.App and others Microsoft.NetCore.App. Ideally, all variants would depend on the latter and light up on the former (when running on Windows).

Current behavior when you rewrite the pwsh.runtimeconfig.json to Microsoft.NetCore.App: https://github.com/PowerShell/PowerShell/issues/12550

Current pwsh.runtimeconfig.json when distributed as a .NET tool:

PS C:\Users\rich> type .\.dotnet\tools\.store\powershell\7.0.0\powershell\7.0.0\tools\netcoreapp3.1\any\win\pwsh.runtimeconfig.json
{
  "runtimeOptions": {
    "tfm": "netcoreapp3.1",
    "framework": {
      "name": "Microsoft.WindowsDesktop.App",
      "version": "3.1.0"
    },
    "rollForwardOnNoCandidateFx": 2,
    "configProperties": {
      "System.Runtime.TieredCompilation": true,
      "System.Runtime.TieredCompilation.QuickJit": true,
      "System.Runtime.TieredCompilation.QuickJitForLoops": true
    }
  }
}
ghost commented 4 years ago

Tagging subscribers to this area: @vitek-karas Notify danmosemsft if you want to be subscribed.