简体   繁体   中英

How do you find out the .NET version of a Windows service?

There are a lot of questions here about finding out what .NET framework is installed. I know that I have upto .NET v4.6.1 installed.

I want to find out what version of .NET a service is built on.

Let's say I have a service (XYZ.exe) installed of .NET v2.0. I make a change to the code and produce another executable of the same name but with .NET v4.6.1 and replace the existing executable (after stopping the service). When I re-start the service, will the service use the new executable (.NET v4.6.1) or does it have a pre-loaded code of the old executable (.NET v2.0) which it uses?

So I think this is the answer. I'd be happy if someone reviews it.

We can go into the registry down to this level:

HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\services\\eventlog\\Application\\<your_service_name>

Then, we look into the value for the key EventMessageFile and it will show you the .NET version for the installed service.

EDIT:

This registry entry will be present only if the Windows service is installed using InstallUtil.exe . If however the Windows service was installed using SC.exe , then the registry entry will be present under:

HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\services\\<your_service_name>

right click the related DLL and find its version in the properties. Also if you are developing - so watch out the DLL probably will be loaded from the GAC and not from your DLL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM