Helan
Posts: 19
Joined: Thu Mar 16, 2017 2:32 pm

Check Windows version inside custom action

Wed Oct 17, 2018 7:43 am

My setup uses a C#/Wix custom action. Inside that custom action I want to check which Windows version the setup is executed on.

I found this forum post about checking Windows version:
viewtopic.php?t=34212

Can I access the "VersionNT", "VersionNT64" and "MsiNTProductType" values from C# code inside the custom action?

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Check Windows version inside custom action

Wed Oct 17, 2018 9:00 am

Hello Helan,

The answer to that is yes, you can access the "VersionNT", "VersionNT64" and "MsiNTProductType" properties from your custom action.

In order to get a property value, you can use the following:

Code: Select all

MyVariable = session["MyProperty"];
In order to set a property value, you can use the following:

Code: Select all

session["MyProperty"] = "MyValue";
Hope this helps.

Kind regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Helan
Posts: 19
Joined: Thu Mar 16, 2017 2:32 pm

Re: Check Windows version inside custom action

Wed Oct 17, 2018 1:19 pm

Thanks! Very easy when you know how to do it. :D

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Check Windows version inside custom action

Wed Oct 17, 2018 1:25 pm

You're always welcome, Helan.

I am glad you got this working.
:D

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”