How am I going to find out if .NET 4.5 is installed on my system?

image1661-570x194_thumb.png

 

It seems to be an easy question but there are also some traps. The reason is that theoretically it is possible to make a difference between CLR Version and Framework Version. In the times of .NET 3.5 it was usual to keep the CLR version still on version 2.0 because there are only new libraries added to the framework.

But “.NET Framework 4.5” usually means the combination of the “newest” frameworks and CLR Version. Although .NET 4.5 is an “in-place-upgrade” for .NET 4.0 what makes the whole situation even more complicated.

Good entrance (and I’m going to talk about this later again) is the post of Scott Hanselman:

.NET Versioning and Multi-Targeting – .NET 4.5 is an in-place upgrade to .NET 4.0

Easy check for: Is the .NET Framework Version 4.5 installed or not?

To clarify what version you’ve got installed you will find an helpful hint from the registry at the pad “Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full”

image

In my cases it is: Jepp – .NET 4.5. Unfortunately this test will only work if you are the system-admin and in full control of the system and the applications.

Does my application run with .NET 4.5?

This doesn’t mean if the application is “compatible” to .NET 4.5 but if the application is able to use the .NET 4.5 features.

It’s kind of difficult to answer this question since this depends on the app.config or the web.config and if the IIS is in the game you have to configure the AppPool properly.

If you read the Hanselman Post you are now going to get a very short version of it Zwinkerndes Smiley

If you run a Desktop Application without the correct framework version in the supportedRuntime Element of the app.config you are going to receive an error message. That’s how I tell my Runtime that my app needs .NET 4.5:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>

When there is no .NET 4.5 that’s your error message:

image1662

There is a similar element for Web-Application in the web.config:

If the Runtime the TargetFramework needs isn’t there you will see another error message if you try to run the Webapp.

Bets Practice: Feature Detection during the runtime

<configuration>
    <system.web>
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
    </system.web>
</configuration>

Since the framework always includes several libraries and every library has a different version number and a different Runtime you might test properly if there is something like a special class for example.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

About the author

Written by

Learn more about our team.

  • http://Website Bharath

    I am running a windows application compiled with .net framework 4.5
    But i am not getting the above popup message to download 4.5 framework instead getting a error message saying application needs .net framework 4.5

    kindly help

    Regards,
    Bharath

    • http://code-inside.de robert.muehsig

      Well – the Popup Messages says the same thing if I understand you correctly.

Recent Posts

  • Time-controlled Azure WebJobs – Azure as easy as it get‘s

        While still in development the Azure WebJob SDK offers some cool features for procession and supply of information. A good example is the sample that observes the Azure Queue and processes an item as soon as it spots one.   Scenario: time-controlled activities – without queue and so on My scenario was quite […]

  • image2021-570x194_thumb.png
    HowTo: Create RSS Feeds with ASP.NET MVC

    I’ve already written about how to consume RSS or Atom Feeds with the SyndicationFeed (in German, sry) but todays post is about how to create or publish an own feed. Beside the age of the feed standard and the much defamation from Facebook, Twitter and Google on RSS/Atom I consider this easy to consume API […]

  • image1997-311x194_thumb.png
    How to access an Azure Website with the local IIS Manager

    Since the end of February it is possible to access an Azure Website with the IIS Manager. Although the Azure Management site offers some information there are more details visible at the IIS Manager. For the connection you will need an IIS Manager and the IIS Manager for Remote Administration Extension. It’s also possible to […]

  • image1929-570x143_thumb.png
    Create and validate own Json-Web-Tokens (JWTs)

    If you are interested in web authentication you probably have heard about JSON Web tokens (JWT). What is a JWT? Maybe I’m not using the correct security termination but however: JWTs are used to exchange claims between two systems. For example: You want to log on to a service (like Facebook, Twitter, etc.) and want […]

  • Micro-Optimization: how to shrink or „embed“ pictures

      I’m currently working on the “CodeInside Dashboard” and since the page structure isn’t that difficult it should be possible to fulfill all of Google Pagespeed or Yahoos YSlow recommendations. One of the rules was to optimize the 4 PNGs that are embedded on the page.   Before – without optimization: Below you can see […]

Support us