Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of new TFMs in runtimeconfig and host #34033

Closed
vitek-karas opened this issue Mar 24, 2020 · 11 comments
Closed

Usage of new TFMs in runtimeconfig and host #34033

vitek-karas opened this issue Mar 24, 2020 · 11 comments
Milestone

Comments

@vitek-karas
Copy link
Member

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.

@vitek-karas vitek-karas added this to the 5.0 milestone Mar 24, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Mar 24, 2020
@vitek-karas
Copy link
Member Author

@terrajobst @jeffschwMSFT

Who is the SDK contact for the TFM work? - the SDK has probably much more "shared store" code in it, which might be affected as well.

@vitek-karas vitek-karas removed the untriaged New issue has not been triaged by the area owner label Mar 24, 2020
@jeffschwMSFT
Copy link
Member

@dsplaisted

@dsplaisted
Copy link
Member

I think we should let this "tfm" be the part of the TargetFramework without the operating system info. So just net5.0, even if the TargetFramework is net5.0-windows. Is there any reason we would need to support a scenario where the shared store or the probing paths would vary based on OS?

@dsplaisted
Copy link
Member

@terrajobst
Copy link
Member

Is this something that needs to be done for .NET 5?

@dsplaisted
Copy link
Member

dsplaisted commented Jul 30, 2020

We are tracking the SDK change for this with dotnet/sdk#11010. I'm not sure if there's any runtime change that will be needed. @vitek-karas

@vitek-karas
Copy link
Member Author

@dsplaisted could you please link the right issue in SDK (the one you linked is from 3 years ago, so probably not the right one)?

I guess it's back to the original question above: What TFM will SDK write to .runtimeconfig.json - is it the simple one net5.0 always, or is it more complicated than that.

/cc @agocke

@dsplaisted
Copy link
Member

@vitek-karas Sorry, I've now corrected the link. Our plan is to write the TargetFramework without platform information to the runtimeconfig.json, ie net5.0 even if the actual TargetFramework is net5.0-windows.

Thanks

@vitek-karas
Copy link
Member Author

Perfect - in that case I don't think there's anything to be done on the hosting side (it all should work just like netcoreapp3.1 for example)

@danmoseley
Copy link
Member

@vitek-karas can we close this issue now then? trying to burn down 5.0 milestone

@vitek-karas
Copy link
Member Author

The SDK in dotnet/sdk#11010 makes sure that it only every writes the simple TFM into the runtime config. Since that is really the only place where TFM is read from in the host, it should all work the same as before and thus no new host work seems to be necessary.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants