Best Way To Determine If .NET 3.5 Is Installed

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

    @komradekatz, your solution below from MSDN for convenience for others looking into this. I do not like this solution because it uses the user agent to determine the version. This is not viable for what I need (I am writing a class library that needs to know whether .NET 3.5 is installed). I also question how reliable this solution may prove to be.

    <%@ Page Language="C#" %>
    
    
    
    
      
        Test for the .NET Framework 3.5
        
        
      
    
      
        

    On my machine this outputs:

    This machine has the correct version of the .NET Framework 3.5.

    This machine's userAgent string is: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; InfoPath.2; .NET CLR 1.1.4322; .NET CLR 3.5.21022; Zune 2.5).

提交回复
热议问题