I am trying to use if...else condition in WIX by checking the registry value.
<Property Id="WINDOWS_VERSION">
<RegistrySearch Id='WinVersion' Type='raw'
Root='HKLM' Key='SOFTWARE\Microsoft\Windows NT\CurrentVersion' Name='ProductName' />
</Property>
<?if [WINDOWS_VERSION] = "Windows 10 Enterprise"?>
<Directory Id="INSTALLDIR" Name="ETMS">
<Directory Id ="BinDir" Name ="BIN">
<Directory Id ="AssemblyDir" Name ="Assembly">
<Component Id ="BinAssemblyFilesFse" Guid ="$(var.BinAssemblyFilesGuid)">
<!-- This section should include any files that need to be deployed to Bin Assembly folder -->
<?include BinAssemblyFiles.wxi?>
</Component>
<!-- Due to a bug in WIX, the shortcut is always pointing to the first file in a component
as a result shortcuts need to be put in their own components. -->
<Component Id="MainExecutable" Guid="$(var.MainExecutableGuid)">
<File Id="EtmsFse.exe" Name ="EtmsFse.exe" Source ="$(var.BuiltComponents)">
<!-- Add shortcut for this file to the created ETMS Program Menu Folder. -->
<Shortcut Advertise="yes" Id="StartMenuEtmsFse" Directory="EtmsProgramMenuDir" Name="ETMS"
WorkingDirectory='Bin' Icon="EtmsFse.exe" IconIndex="0" >
<!-- Set the AppID in order to get toasts to work -->
<ShortcutProperty Key="System.AppUserModel.ID" Value="FSE"></ShortcutProperty>
<!-- Set the ToastActivatorCLSID in order to get notifications working in Action Center -->
<ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{3BD0C45A-B130-4709-BF6F-E786195E7FF9}"></ShortcutProperty>
</Shortcut>
<Shortcut Advertise="yes" Id="desktopEtmsFse" Directory="DesktopFolder" Name="ETMS"
WorkingDirectory='Bin' Icon="EtmsFse.exe" IconIndex="0" >
<!-- Set the AppID in order to get toasts to work -->
<ShortcutProperty Key="System.AppUserModel.ID" Value="FSE"></ShortcutProperty>
<!-- Set the ToastActivatorCLSID in order to get notifications working in Action Center -->
<ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{3BD0C45A-B130-4709-BF6F-E786195E7FF9}"></ShortcutProperty>
</Shortcut>
</File>
<RemoveFolder Id="DelProgramMenuDir" On="uninstall" Directory="EtmsProgramMenuDir"/>
</Component>
</Directory>
<?else?>
<Directory Id="INSTALLDIR" Name="ETMS">
<Directory Id ="BinDir" Name ="BIN">
<Directory Id ="AssemblyDir" Name ="Assembly">
<Component Id ="BinAssemblyFilesFse" Guid ="$(var.BinAssemblyFilesGuid)">
<!-- This section should include any files that need to be deployed to Bin Assembly folder -->
<?include BinAssemblyFiles.wxi?>
</Component>
<!-- Due to a bug in WIX, the shortcut is always pointing to the first file in a component
as a result shortcuts need to be put in their own components. -->
<Component Id="MainExecutable" Guid="$(var.MainExecutableGuid)">
<File Id="EtmsFse.exe" Name ="EtmsFse.exe" Source ="$(var.BuiltComponents)">
<!-- Add shortcut for this file to the created ETMS Program Menu Folder. -->
<Shortcut Advertise="yes" Id="StartMenuEtmsFse" Directory="EtmsProgramMenuDir" Name="ETMS"
WorkingDirectory='Bin' Icon="EtmsFse.exe" IconIndex="0" >
</Shortcut>
<Shortcut Advertise="yes" Id="desktopEtmsFse" Directory="DesktopFolder" Name="ETMS"
WorkingDirectory='Bin' Icon="EtmsFse.exe" IconIndex="0" >
</Shortcut>
</File>
<RemoveFolder Id="DelProgramMenuDir" On="uninstall" Directory="EtmsProgramMenuDir"/>
</Component>
</Directory>
<?endif?>
I am very sure that the value I from the registry is "Windows 10 Enterprise" but somehow it doesn't goes to the if condition. Does anyone know what's wrong with it?
Thanks!
[Update] I wanted to add Toast notification but this feature only available starting from Windows 8. That's why I am trying to do a if...else condition to check the Windows version. Toast notification need the line below...
<!-- Set the AppID in order to get toasts to work -->
<ShortcutProperty Key="System.AppUserModel.ID" Value="FSE"></ShortcutProperty>
<!-- Set the ToastActivatorCLSID in order to get notifications working in Action Center -->
<ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{3BD0C45A-B130-4709-BF6F-E786195E7FF9}"></ShortcutProperty>