GaidinD
GaidinD

Reputation: 362

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?

Upvotes: 3

Views: 3287

Answers (2)

GaidinD
GaidinD

Reputation: 362

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>

Upvotes: 4

Dan Kuida
Dan Kuida

Reputation: 1057

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

Upvotes: 1

Related Questions