Best Way To Determine If .NET 3.5 Is Installed

前端 未结 9 1592
时光取名叫无心
时光取名叫无心 2021-02-05 12:43

I need to programatically determine whether .NET 3.5 is installed. I thought it would be easy:

<% Response.Write(Environment.Version.ToString()); %>
         


        
9条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-05 13:40

    @Kev, really like your solution. Thanks for the help.

    Using the registry the code would look something like this:

    RegistryKey key = Registry
            .LocalMachine
            .OpenSubKey("Software\\Microsoft\\NET Framework Setup\\NDP\\v3.5");
    return (key != null);
    

    I would be curious if either of these would work in a medium trust environment (although I am working in full trust so it doesn't matter to what I am currently working on).

提交回复
热议问题