Identifies the version of .NET that a particular assembly was compiled against.
public ref class TargetFrameworkAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed class TargetFrameworkAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)>]
type TargetFrameworkAttribute = class
inherit Attribute
Public NotInheritable Class TargetFrameworkAttribute
Inherits Attribute
The TargetFrameworkAttribute class provides an attribute that you can apply to an assembly to indicate the version of the .NET runtime against which the assembly was built. For example, the following example applies the TargetFrameworkAttribute
to an assembly to indicate that it was built using .NET Framework 4.
using System;
using System.Runtime.Versioning;
[assembly:TargetFramework(".NETFramework,Version=v4.0")]
namespace MyCompany.Utilities
{
public class StringLibrary
{
// Members defined here.
}
}
Imports System.Runtime.Versioning
<Assembly:TargetFramework(".NETFramework,Version=v4.0)")>
Namespace MyCompany.Utilities
Public Class StringLibrary
' Members defined here.
End Class
End Namespace
The TargetFrameworkAttribute class constructor has a single parameter, frameworkName
, that specifies the .NET version against which the assembly was built. This parameter maps to the FrameworkName property. In addition, the TargetFrameworkAttribute attribute can specify a FrameworkDisplayName property to provide a more descriptive .NET version string that is suitable for displaying to clients of the assembly. The following example applies the TargetFrameworkAttribute
to an assembly and assigns both property values to indicate that the assembly was built using .NET Framework 4.
using System;
using System.Runtime.Versioning;
[assembly:TargetFramework(".NETFramework,Version=v4.0",
FrameworkDisplayName = ".NET Framework, Version 4.0")]
namespace MyCompany.Utilities
{
public class StringLibrary
{
// Members defined here.
}
}
Imports System.Runtime.Versioning
<Assembly:TargetFramework(".NETFramework,Version=v4.0)", _
FrameworkDisplayName := ".NET Framework, Version 4.0")>
Namespace MyCompany.Utilities
Public Class StringLibrary
' Members defined here.
End Class
End Namespace
Constructors Properties FrameworkDisplayName
Gets the display name of the .NET version against which an assembly was built.
FrameworkNameGets the name of the .NET version against which a particular assembly was compiled.
TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute.
(Inherited from Attribute) Methods Explicit Interface Implementations _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)Maps a set of names to a corresponding set of dispatch identifiers.
(Inherited from Attribute) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)Retrieves the type information for an object, which can be used to get the type information for an interface.
(Inherited from Attribute) _Attribute.GetTypeInfoCount(UInt32)Retrieves the number of type information interfaces that an object provides (either 0 or 1).
(Inherited from Attribute) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)Provides access to properties and methods exposed by an object.
(Inherited from Attribute) See alsoCollaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4