Determine the Servicepack of .NET Framework
Frank Dzaebel, created: 24.3.2005, last updated: 30.01.2010
Category: Versionen, .NET-Version: 1-4
The safe method to determine which Servicepack on which .NET Runtime is installed is - looking to the file version of one of the core assemblies inside the installed framework-folder.
While there is no real tool for that at moment, users made their own.
For example see : DotNet VersionCheck Utility,
or Aron Astebners setup verification tool, where you do not have
an overview and must manually check all frameworks and must agree with license,
but proof against a bunch of files.
Here is one possibility from my side, where you have a solid overwiew of all .NET
versions.:
For information material for current servicepacks about .NET Framework see also
here.
Download batch file. After starting, compare the product version(s) here:
@echo off
REM -----------------------------------------------------*
REM * NetVersion.bat *
REM * Show installed Versions (SPs) of .NET Frameworks *
REM * Frank Dzaebel, 21.05.2009 *
REM *----------------------------------------------------*
if "%1"=="" goto Start
if "%1"=="/Single" goto Single
if "%1"=="/TempVersion" goto TempVersion
echo wrong Option %1
exit
:Start
echo.
echo.Installed .NET Framework-Versions :
echo.
for /D %%i in (%windir%\Microsoft.NET\Framework\v?"."*) DO call %0 /Single %%i
set info=Hotfix for Microsoft .NET Framework 3.0 - KB958483 - Dez 2008
set asm=%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll
if exist "%asm%" call "%OutExe%" "%asm%" "%info%" "3.0.6920.1500"
set info=Hotfix for Microsoft .NET Framework 3.5 - KB958484 - Dez 2008
set asm=%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5\system.data.services.client.dll
if exist "%asm%" call "%OutExe%" "%asm%" "%info%" "3.5.30729.196"
set info=New Data.Services for .NET Framework 3.5 SP1 - KB976127 Win7.. - Jan 2010
set asm=%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5\system.data.services.client.dll
if exist "%asm%" call "%OutExe%" "%asm%" "%info%" "3.5.30729.5004"
set info=New Data.Services for .NET Framework 3.5 SP1 - KB976127 XP.. - Jan 2010
set asm=%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5\system.data.services.client.dll
if exist "%asm%" call "%OutExe%" "%asm%" "%info%" "3.5.30729.4466"
echo.
pause && Goto Finish
:Single
set asm=mscorwks.dll
if exist "%2\%asm%" call %0 /TempVersion %2 "%asm%"
set asm=Windows Communication Foundation\Infocard.exe
if exist "%2\%asm%" call %0 /TempVersion %2 "%asm%"
set asm=Microsoft.Build.Tasks.v3.5.dll
if exist "%2\%asm%" call %0 /TempVersion %2 "%asm%"
set asm=Microsoft.Build.Tasks.v4.0.dll
if exist "%2\%asm%" call %0 /TempVersion %2 "%asm%"
Goto Finish
:TempVersion
set CsFile=%TEMP%\VersionTmp.cs
set OutExe=%TEMP%\VersionTmp.exe
if exist "%OutExe%" call "%OutExe%" "%2\%~3" && goto Finish
echo. using System; using System.Diagnostics; >"%CsFile%"
echo. class Class1 >>"%CsFile%"
echo. { static void Main(string[] args){ >>"%CsFile%"
echo. string pfad = Environment.ExpandEnvironmentVariables(args[0]); >>"%CsFile%"
echo. FileVersionInfo v=FileVersionInfo.GetVersionInfo(pfad); >>"%CsFile%"
echo. if (args.Length == 3){string info = args[1]; >>"%CsFile%"
echo. string vCheck = args[2]; >>"%CsFile%"
echo. if (v.ProductVersion != vCheck) return; >>"%CsFile%"
echo. Console.WriteLine(info); >>"%CsFile%"
echo. } Console.WriteLine(v.ToString()); >>"%CsFile%"
echo. }} >>"%CsFile%"
"%2\csc.exe" /nologo /target:exe /out:"%OutExe%" "%CsFile%"
"%OutExe%" "%2\%~3"
:Finish