Skip to content

Usage of new TFMs in runtimeconfig and host #34033

@vitek-karas

Description

@vitek-karas

The new set of TFMs as per the design is relatively large as the TFM now contains not just the version of .NET but also the target OS and possibly even OS version.

Currently the SDK writes the TFM into .runtimeconfig.json into a tfm property. Typical .runtimeconfig.json:

{
  "runtimeOptions": {
    "tfm": "netcoreapp3.1",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "3.1.0"
    }
  }
}

The value comes directly from the <TargetFramework> property in the project file.

The value in .runtimeconfig.json is used only in two relatively fringe scenarios in the host:

  • When the host probes for shared store paths, the path is in the form of $DOTNET_SHARED_STORE/|arch|/|tfm| where the |tfm| is replaced by the value from the tfm property.
  • When the host probes for additional paths (specified as either command line or config options) the path can contain the string |arch|/|tfm| where it's again replaced with the value of the tfm property.

The most common usage of these is the .runtimeconfig.dev.json (auto-generated by SDK during dotnet build) which contains path to the user-local shared store:

{
  "runtimeOptions": {
    "additionalProbingPaths": [
      "C:\\Users\\username\\.dotnet\\store\\|arch|\\|tfm|",

and then any usage of the shared store, where the folder structure on disk must match the TFM used in the configuration file.

If we keep the behavior as is, it would mean that these shared store paths would now include the full TFMs - like net5.0-windows10.0 or similar.

Without any changes the shared store may need to have multiple copies of the same file for all of the hierarchical TFMs: net5, net5.0, net5.0-windows and net5.0-windows10 if it would server multiple apps each using slightly different but still fully compatible TFM.

The question is if the SDK should write the "Simple" TFM into the .runtimeconfig.json - in this case probably net5.0 or if the host will have to start understanding the hierarchical nature of TFMs and be able to parse them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions