Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens if I don't specify targetFramework="4.0"?

In my ASP.Net 4.0 web.config I had the following attribute:

<compilation targetFramework="4.0">

If I remove the targetFramework attribute, everything appears to carry on as normal. Under what circumstances does this attribute help me?

like image 231
dwynne Avatar asked Jun 02 '10 19:06

dwynne


People also ask

What is targetFramework in web config?

The 'targetFramework' attribute in the element of the Web. config file is used only to target version 4.0 and later of the . NET Framework (for example, ''). After an upgrade to the WhatsUp Gold server, I cannot load the Web Console.

What does targetFramework mean?

When you target a framework in an app or library, you're specifying the set of APIs that you'd like to make available to the app or library. You specify the target framework in your project file using a target framework moniker (TFM). An app or library can target a version of .


1 Answers

Quote from the doc:

Specifies the version of the .NET Framework that the Web site targets.

The default is Null.

If this attribute is omitted, the target version is determined by other settings in the Web.config file and by the IIS application pool that the Web site is associated with. For more information, see CompilationSection.TargetFramework and .NET Framework Multi-Targeting for ASP.NET Web Projects.

So basically if your application pool in IIS targets ASP.NET 4.0 and you omit this attribute nothing happens => your site still uses .NET 4.0

like image 127
Darin Dimitrov Avatar answered Sep 21 '22 07:09

Darin Dimitrov