Partager via


Where is ASP.NET 4.5 …wait Where is .NET 4.5 ?

When .NET 3.5 was released a lot of people wondered why ASP.NET 3.5 wouldn’t show up in IIS. https://blogs.msdn.com/b/vijaysk/archive/2008/03/20/running-asp-net-3-5-on-iis.aspx

Well with .NET 4.5 you might be a bit more confused…

So first .NET 4.5 will not show up in IIS

image

But now if you check the Microsoft.NET framework folder you will see that you will not have a .NET 4.5 folder as well

image

Well Why ?

If you have read my previous post by now you would have understood that there are two ways the .NET framework is upgraded.

1. Side By Side release – Like v1.1 and v2.0. There releases are completely independent of each other

2. Enhancements – Like v3.0 and 3.5

.NET 3.5 and .NET 3.0 are just additions to the .NET 2.0. So the v2.0 folder has all the .NET 2.0 files and v3.0 and v3.5 folders have all the files that are required for the enhancements like WCF, LINQ. If you wanted to use these enhancements in ASP.NET your web.config files had to explicitly have references to these 3.5 assemblies.

.NET 4 is a Side By Side upgrade. Which means it can exist independent of v1.1 and v2.0.

.NET 4.5 is an enhancement, but unlike 3.0 or 3.5 it will not be separated out. It is an in place upgrade.

Which means once you install .NET 4.5 the v4.0 folder will be updated to contain all the .NET 4.5 files.

Does that mean you wiped out .NET 4.0 from your machine ?

Well yes and no.

Yes, because the installation updates the v4.0 folder to .NET 4.5

My machine has both VS 2010 and VS 2012 installed. If I launch the VS 2010 Command Prompt and run launch the C Sharp compiler it will say 4.5. There is no compiler for 4.0 after the upgrade.

image

No, because even though you now have a single updated folder, you can control which version of .NET 4 your application will use.

Visual Studio 2012 provides you an option to target either .NET 4 or .NET 4.5

image

 

When you switch the Target framework in Visual Studio two thing happen

1. The config file will reflect the targetFramework

A .NET 4.5 web.config will have an entry similar to

<compilation debug="true" targetFramework="4.5"/>

and if you choose .NET 4 it will be

<compilation debug="true" targetFramework="4.0"/>

Similarly in a Windows Application the version is controlled in its app.config file with

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>

or

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>

2. The reference assemblies for the common namespaces like System are updated.

image

The reference assemblies are still separate for .NET 4 and .NET 4.5

image

 

Do you have to upgrade your existing ASP.NET 4 web application to .NET 4.5 because of this?

No,  if you have an ASP.NET web application built using VS 2010, it will have a compilation tag with targetFramework="4.0" in its web.config already.

Which means it will continue to work fine even after the .NET 4.5 upgrade.

In case you want to use the new .NET 4.5 features like async that's when you will have to upgrade your web application.

Comments

  • Anonymous
    October 12, 2012
    Very helpful post. Thank you.

  • Anonymous
    October 13, 2012
    Thanks. Make things much clear.

  • Anonymous
    October 15, 2012
    Really like that you are providing such info on .net being enrolled in .NET freshers training at www.wiziq.com/.../57-fresher-training-projects i really thank that you are providing such information.Thanks a lot.

  • Anonymous
    June 10, 2013
    Thanks for the info!  That made me feel a little better about the upgrade process.

  • Anonymous
    October 25, 2013
    "In case you want to use the new .NET 4.5 features like async that's when you will have to upgrade your web application." Isn't it that Once 4.5 is installed then everything that used 4.0 before will use 4.5.? Do we need to upgrade our web application manually?

  • Anonymous
    March 05, 2015
    Good blog I have solved my prob. Thanks