Class TargetFrameworkExtensions
- Namespace
- Splat
- Assembly
- Splat.dll
Provides extension methods for retrieving target framework information from assemblies.
public static class TargetFrameworkExtensions
- Inheritance
-
TargetFrameworkExtensions
Remarks
This class contains static methods that extend the functionality of the Assembly type, enabling callers to determine the target framework an assembly was built against. These methods are useful for scenarios where runtime inspection of assembly metadata is required, such as diagnostics, tooling, or compatibility checks.
Methods
GetTargetFrameworkName(Assembly)
Retrieves the target framework name specified for the given assembly, if available.
public static string? GetTargetFrameworkName(this Assembly assembly)
Parameters
assemblyAssemblyThe assembly from which to obtain the target framework name. Cannot be null.
Returns
- string
A string containing the target framework name (for example, ".NETCoreApp,Version=v8.0"), or null if the assembly does not specify a target framework.
Remarks
The target framework name is typically defined by the TargetFrameworkAttribute applied to the assembly. If the attribute is not present, this method returns null.