Jul 6, 2011

Which .NET version a running program is using?


I was asked a question by a colleague:
He has many .NET framework installed on machine. Once he has a program running on the system, what he knows is that program is a .NET developed program, and he would like to further identify which .NET version the program is using.

I didn't know the answer, but today I read 《CLR via C#》, I got the answer:

1, go to registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP
You will know what versions of .NET Framework is installed on the machine.
2, go to any .NET Framework SDK,

If you have Visual Studio installed on your computer: On the taskbar, click Start, click All Programs, click Visual Studio, click Visual Studio Tools, and then click Visual Studio Command Prompt.

-or-

If you have the Windows SDK installed on your computer: On the taskbar, click Start, click All Programs, click the folder for the Windows SDK, and then click Command Prompt (or CMD Shell).


for example in Visual Studio 2010 prompt, which might be
C:\Program Files\Microsoft Visual Studio 10.0\VC;
3, CLRVer.exe -all
This command can show which version of the CLR is being used by processes running ont he machine or you can pass the ID of the processs you are interested in.

Keep reading...

No comments: