locked
How to use C# to know if .net framework 2.0 has been installed or not? RRS feed

  • Question

  • Hi,

    I am doing a windows application using C# and VS 2005. I would like to know if  there is a .net framework 2.0 has been installed on a computer or not. If it has not been installed, the program will install it, otherwise just ignore it. How can I use C# to know  if .net framework 2.0 has been installed or not? Thanks.
    Sunday, August 31, 2008 3:01 PM

Answers

  • Scripting languages are a dime a dozen.  You should probably pick something that makes sense within the context of what you're trying to do.  Use this for example.
    Hans Passant.
    • Proposed as answer by jack 321 Wednesday, September 3, 2008 6:14 AM
    • Marked as answer by jack 321 Thursday, September 4, 2008 2:24 AM
    Sunday, August 31, 2008 3:53 PM

All replies

  • You've got a chicken and egg problem.  You can't use C# to check if .NET is installed, C# requires .NET to be installed.  You could use a scripting language to check if the HKLM\Software\Microsoft\.NETFramework\v2.0.50727 registry key is present.
    Hans Passant.
    Sunday, August 31, 2008 3:24 PM
  • Thanks for your reply. Any ideas about the scripting language to this registry or any hyperlink for it?
    Sunday, August 31, 2008 3:35 PM
  • Scripting languages are a dime a dozen.  You should probably pick something that makes sense within the context of what you're trying to do.  Use this for example.
    Hans Passant.
    • Proposed as answer by jack 321 Wednesday, September 3, 2008 6:14 AM
    • Marked as answer by jack 321 Thursday, September 4, 2008 2:24 AM
    Sunday, August 31, 2008 3:53 PM