BuildManager.TargetFramework Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the target version of the .NET Framework for the current Web site.
public:
static property System::Runtime::Versioning::FrameworkName ^ TargetFramework { System::Runtime::Versioning::FrameworkName ^ get(); };
public static System.Runtime.Versioning.FrameworkName TargetFramework { get; }
static member TargetFramework : System.Runtime.Versioning.FrameworkName
Public Shared ReadOnly Property TargetFramework As FrameworkName
Property Value
The target version of the .NET Framework for the current Web site.
Remarks
This property supports the ASP.NET multi-targeting feature, which enables you to use the latest version of Visual Studio to develop applications that will run with earlier versions of the .NET Framework. A build provider can use this property to make sure that the provider generates code that is appropriate for the targeted version of the .NET Framework. For example, you might want to generate different code depending on whether a Web site targets the .NET Framework 3.5 or the .NET Framework 4. For more information about multi-targeting, see .NET Framework Multi-Targeting for ASP.NET Web Projects.
If the Web site does not have a Web.config file, ASP.NET assumes that the target framework version is the version that is associated with the IIS application pool that the site is running under. For a file-system Web site that is running in Visual Studio, the default framework version is the current version of the .NET Framework.
If the Web site does have a Web.config file, ASP.NET determines the target framework by examining the Web.config file.