다음을 통해 공유


Checking for the .NET Framework at application runtime, not just at setup time

I posted some updated sample code last night that can be used to detect whether or not the various versions of the .NET Framework are installed on a system. To go along with this sample code, I wanted to also mention a consideration that developers should keep in mind when building an application that relies upon the .NET Framework.

It is common to see an application add code to their setup to check for the .NET Framework and install it as a prerequisite at setup time. It is less common (at least in my experience) for an application to perform a runtime check in your application startup code to validate that the necessary version of the .NET Framework is installed.

The .NET Framework can be independently uninstalled out from under your application if a user finds it and removes it in the Add/Remove Programs control panel. I strongly recommend adding logic like I demonstrated in my sample code to your application's startup code paths. Doing so makes your application more bulletproof and allows you to display more user friendly error messages with exact steps that users can follow to resolve issues related to the .NET Framework.

Comments

  • Anonymous
    August 03, 2006
    PingBack from http://blogs.msdn.com/astebner/articles/574618.aspx
  • Anonymous
    August 04, 2006
    >I strongly recommend adding logic...to your application...

    I assume you mean via a non-managed kickstart app that does the check and then hands off control?
  • Anonymous
    August 05, 2006
    The comment has been removed
  • Anonymous
    July 18, 2007
    The comment has been removed