IT박스

.NET 3.5 SP1이 설치되었는지 어떻게 알 수 있습니까?

itboxs 2020. 9. 7. 07:57
반응형

.NET 3.5 SP1이 설치되었는지 어떻게 알 수 있습니까?


.NET 3.5가 설치된 서버에 SP1이 설치되었는지 어떻게 알 수 있습니까?


제어판에서 프로그램 추가 / 제거를 사용하십시오.


보세요 HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5\. 다음 중 하나가 참이어야합니다.

  • Version해당 키 값은 3.5.30729.01 이어야합니다 .
  • 또는 SP동일한 키 값은 1 이어야합니다.

C # (첫 번째 주석에서 가져옴)에서는 다음과 같은 작업을 수행 할 수 있습니다.

const string name = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5";
RegistryKey subKey = Registry.LocalMachine.OpenSubKey(name);
var version = subKey.GetValue("Version").ToString();
var servicePack = subKey.GetValue("SP").ToString();

서버에서 IE를 사용하여 SmallestDotNet으로 이동할 수 있습니다. 그러면 버전이 표시되고 오래된 경우 다운로드 링크도 제공됩니다.


원격 데스크톱 또는 레지스트리에 액세스하지 않고 서버에 설치된 프레임 워크 버전을 감지하는 방법을 알아 내려고이 페이지에 왔기 때문에 Danny V의 답변이 효과적이었습니다.

string path = System.Environment.SystemDirectory;
path = path.Substring( 0, path.LastIndexOf('\\') );
path = Path.Combine( path, "Microsoft.NET" );
// C:\WINDOWS\Microsoft.NET\

string[] versions = new string[]{
    "Framework\\v1.0.3705",
    "Framework64\\v1.0.3705",
    "Framework\\v1.1.4322",
    "Framework64\\v1.1.4322",
    "Framework\\v2.0.50727",
    "Framework64\\v2.0.50727",
    "Framework\\v3.0",
    "Framework64\\v3.0",
    "Framework\\v3.5",
    "Framework64\\v3.5",
    "Framework\\v3.5\\Microsoft .NET Framework 3.5 SP1",
    "Framework64\\v3.5\\Microsoft .NET Framework 3.5 SP1",
    "Framework\\v4.0",
    "Framework64\\v4.0"
};

foreach( string version in versions )
{
    string versionPath = Path.Combine( path, version );

    DirectoryInfo dir = new DirectoryInfo( versionPath );
    if( dir.Exists )
    {
        Response.Output.Write( "{0}<br/>", version );
    }
}

Take a look at this article which shows the registry keys you need to look for and provides a .NET library that will do this for you.

First, you should to determine if .NET 3.5 is installed by looking at HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5\Install, which is a DWORD value. If that value is present and set to 1, then that version of the Framework is installed.

Look at HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5\SP, which is a DWORD value which indicates the Service Pack level (where 0 is no service pack).

To be correct about things, you really need to ensure that .NET Fx 2.0 and .NET Fx 3.0 are installed first and then check to see if .NET 3.5 is installed. If all three are true, then you can check for the service pack level.


Check is the following directory exists:

In 64bit machines: %SYSTEMROOT%\Microsoft.NET\Framework64\v3.5\Microsoft .NET Framework 3.5 SP1\

In 32bit machines: %SYSTEMROOT%\Microsoft.NET\Framework\v3.5\Microsoft .NET Framework 3.5 SP1\

Where %SYSTEMROOT% is the SYSTEMROOT enviromental variable (e.g. C:\Windows).


Assuming that the name is everywhere "Microsoft .NET Framework 3.5 SP1", you can use this:

string uninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(uninstallKey))
{
    return rk.GetSubKeyNames().Contains("Microsoft .NET Framework 3.5 SP1");
}

참고URL : https://stackoverflow.com/questions/198931/how-do-i-tell-if-net-3-5-sp1-is-installed

반응형