Best Way To Determine If .NET 3.5 Is Installed

.net, .net-3.5, installation, registry

Solution

You could try:

static bool HasNet35()
{
    try
    {
        AppDomain.CurrentDomain.Load(
            "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
        return true;
    }
    catch
    {
        return false;
    }
}

@Nick: Good question, I'll try it in a bit.

Kev

Problem

I need to programatically determine whether .NET 3.5 is installed. I thought it would be easy: ``` <% Response.Write(Environment.Version.ToString()); %> ``` Which returns "2.0.50727.1434" so no such luck... In my research I have that there are some rather obscure registry keys I can look at but I'm not sure if that is the route to go. Does anyone have any suggestions?

Original source