Best Way To Determine If .NET 3.5 Is Installed

前端 未结 9 1591
时光取名叫无心
时光取名叫无心 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:25

    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

提交回复
热议问题