Reputation: 3
I received WiX code which used method from discussion VersionNT MSI property on Windows 10
My Product.wxs:
<!-- begin hack - detect windows 10 -->
<!-- Check if system is windows 10: https://stackoverflow.com/questions/31932646/versionnt-msi-property-on-windows-10 -->
<Property Id="WIN10FOUND">
<DirectorySearch Id="searchSystem" Path="[SystemFolder]" Depth="0">
<FileSearch Id="searchFile" Name="advapi32.dll" MinVersion="6.3.10000.0"/>
</DirectorySearch>
</Property>
<SetProperty Action="SetIsWindow10False" Id="ISWIN10" After="FindRelatedProducts" Value="0"><![CDATA[WIN10FOUND = ""]]></SetProperty>
<SetProperty Action="SetIsWindow10True" Id="ISWIN10" After="FindRelatedProducts" Value="1"><![CDATA[WIN10FOUND <> ""]]></SetProperty>
<!-- end hack - detect windows 10 -->
<SetProperty Action="SetMyDriverPathToInstallDir" Id="MYDRRVPATH" After="FindRelatedProducts" Value=""><![CDATA[ISWIN10 <> 1]]></SetProperty>
<SetProperty Action="SetMyDriverPathToInstallDir_Win10" Id="MYDRVPATH" After="FindRelatedProducts" Value="MyDrvDriverWin10\"><![CDATA[ISWIN10 = 1]]></SetProperty>
...
<InstallExecuteSequence>
...
<Custom Action="InstallMyDriverDriver" Before="InstallFinalize"><![CDATA[(NOT Installed AND NOT REMOVE) AND VDIENV <>"1" AND NOQOS <> "1" AND ISWIN10 = 0]]></Custom>
<Custom Action="InstallMyDriverDriver10" Before="InstallFinalize"><![CDATA[(NOT Installed AND NOT REMOVE) AND VDIENV <>"1" AND NOQOS <> "1" AND ISWIN10 = 1]]></Custom>
...
</InstallExecuteSequence>
But from installer logs I see that order of these properties is inverted
MSI (s) (FC:A4) [16:19:02:683]: Doing action: SetMyDriverPathToInstallDir
MSI (s) (FC:A4) [16:19:02:683]: Note: 1: 2205 2: 3: ActionText
Action ended 16:19:02: SetCredentialFilter. Return value 1.
Action start 16:19:02: SetMyDriverPathToInstallDir.
MSI (s) (FC:A4) [16:19:02:684]: Skipping action: SetMyDriverPathToInstallDir_Win10 (condition is false)
MSI (s) (FC:A4) [16:19:02:684]: Doing action: SetIsWindow10False
MSI (s) (FC:A4) [16:19:02:684]: Note: 1: 2205 2: 3: ActionText
Action ended 16:19:02: SetMyDriverPathToInstallDir. Return value 1.
MSI (s) (FC:A4) [16:19:02:685]: PROPERTY CHANGE: Adding ISWIN10 property. Its value is '0'.
Action start 16:19:02: SetIsWindow10False.
MSI (s) (FC:A4) [16:19:02:685]: Skipping action: SetIsWindow10True (condition is false)
MSI (s) (FC:A4) [16:19:02:685]: Skipping action: SetUpgrading (condition is false)
MSI (s) (FC:A4) [16:19:02:685]: Doing action: SetVersion
MSI (s) (FC:A4) [16:19:02:685]: Note: 1: 2205 2: 3: ActionText
Action ended 16:19:02: SetIsWindow10False. Return value 1.
...
MSI (s) (FC:A4) [16:19:02:695]: PROPERTY CHANGE: Adding WIN10FOUND property. Its value is 'C:\Windows\SysWOW64\advapi32.dll'.
i.e. WIN10FOUND is defined first but called last path for draiver is defined last but called first
So, install path for driver is not corrected for Win10 and there are some problem.
Could someone help me to understand the reason which installer sets properties in incorrect order?
Upvotes: 0
Views: 145
Reputation: 42126
I wrote this answer a couple of weeks ago on this issue: Windows 10 not detecting on installshield. I suppose the WindowsBuild property described in this linked answer is one way to (currently) determine if you are on Windows 10 or not. The other options listed might also work - I just haven't tested them much. I am not sure exactly what your needs are.
As stated elsewhere you are not supposed to check for OS version anymore, but rather check for the OS feature you need (which could have been disabled by administrators). Another instance proving that in theory there should be no difference between theory and practice, but in practice there is.
I will check in with others on how to properly check these Windows 10 features. I am outdated.
Upvotes: 1
Reputation: 3413
I guess your problem is caused because you are using this to set all your properties.
After="FindRelatedProducts"
Assume this is your initial execute sequence:
.
.
FindRelatedProducts
Then you say:
<SetProperty Action="SetIsWindow10False" Id="ISWIN10" After="FindRelatedProducts" Value="0"><![CDATA[WIN10FOUND = ""]]></SetProperty>
You execute sequence will be like this:
.
.
FindRelatedProducts
SetIsWindow10False
Then you say:
<SetProperty Action="SetMyDriverPathToInstallDir_Win10" Id="MYDRVPATH" After="FindRelatedProducts" Value="MyDrvDriverWin10\"><![CDATA[ISWIN10 = 1]]></SetProperty>
You execute sequence will be like this:
.
.
FindRelatedProducts
SetMyDriverPathToInstallDir_Win10
SetIsWindow10False
In the end your execute sequence will be like this:
.
.
FindRelatedProducts
SetMyDriverPathToInstallDir_Win10
SetMyDriverPathToInstallDir
SetIsWindow10True
SetIsWindow10False
If you need to have a specific sequence, then try something like this:
<SetProperty Action="SetIsWindow10False" Id="ISWIN10" After="FindRelatedProducts" Value="0"><![CDATA[WIN10FOUND = ""]]></SetProperty>
<SetProperty Action="SetIsWindow10True" Id="ISWIN10" After="SetIsWindow10False" Value="1"><![CDATA[WIN10FOUND <> ""]]></SetProperty>
<!-- end hack - detect windows 10 -->
<SetProperty Action="SetMyDriverPathToInstallDir" Id="MYDRRVPATH" After="SetIsWindow10True" Value=""><![CDATA[ISWIN10 <> 1]]></SetProperty>
<SetProperty Action="SetMyDriverPathToInstallDir_Win10" Id="MYDRVPATH" After="SetMyDriverPathToInstallDir" Value="MyDrvDriverWin10\"><![CDATA[ISWIN10 = 1]]></SetProperty>
This will result in something like this:
.
.
FindRelatedProducts
SetIsWindow10False
SetIsWindow10True
SetMyDriverPathToInstallDir
SetMyDriverPathToInstallDir_Win10
To check how the sequence will be executed, you can open your installer using Orca, this is the best tool the review the internals of an installer.
Upvotes: 2