How to tell what version of the .NET CLR is loaded

2019-06-02 06:57发布

问题:

I know that there are managed shell extensions loaded by explorer.exe on a computer. I want to know what version of the CLR is loaded into explorer.exe. If I am running Vista or Win7, I can use Process Explorer and look at the .NET Assemblies tab of the properties for explorer.exe. However, this doesn't work on XP. Is there a way to get this info on XP?

回答1:

Doesn't Process Explorer also show the the DLLs that have been loaded? Look for mscorwks.dll in that list, and see where it's being loaded from. (That's the workstation version - I can't remember what the server version is, but I don't imagine you'll see it on an XP box anyway. Look for anything beginning with mscor as a first approximation.)



回答2:

If you have Visual Studio installed on the target computer you can use clrver<pid> from a Visual Studio Command Prompt to see what version(s) of the CLR are loaded in a process.

For example:

C:\>clrver 4900
v2.0.50727

This indicates that the process with PID 4900 has .NET 2 loaded.

C:\>clrver -h
Displays CLR versions
Usage: clrver [-?|-all|<PID>]

        -all   - Displays all processes on the machine using the CLR.
        <PID> - Displays the version of the CLR used by the specified process.
        -?    - Displays this help screen.

If called with no options, clrver will display all installed CLR versions.