Skip to content

Add new API to expose framework information about the current app #33472

Closed
@vitek-karas

Description

@vitek-karas

Add a public API which would expose information about the frameworks the app is using:

  • The framework name
  • The framework version
  • The location of the framework (directory path)
  • Maybe: Roll forward information - what version the app asked for (and what it ended up getting as above)

This should work for both framework-dependent and self-contained apps. Self-contained apps include frameworks in them, starting with 3.1 the SDK writes this information into the .runtimeconfig.json and the host reads it. Such frameworks would not have location - we could return either null for location or the path to the app. (I would prefer null to make it easy to distinguish between the framework-dependent and self-contained cases).

The API may look like this (needs more work):

namespace System.Runtime.InteropServices
{
    // New class - represents information about one framework
    public class FrameworkInformation
    {
        public string Name { get; }
        public Version Version { get; }
        public string Location { get; }
        public Version RequestedVersion { get; } // maybe?
    }

   public static class RuntimeInformation
   {
       public static IEnumerable<FrameworkInformation> GetFrameworksInformation();
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationarea-Host

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions