Search code examples
c#visual-studio-2010wixconditional-statementsdeployment-project

WIX Operating System Condition Always true


I have a DLL that I need to install in a specific folder based on which OS I'm installing on.

For XP it is installed in system32, while on Win7 it is installed in SysWow64.

The solution is C# and I am using a deployment project.

In the deployment project, using the file system editor I added both system32 and SysWow64 with the DLL inside both.

At the folder level I am using the condition field to create the folder/dll or not.

For System32 I have the condition [CDATA[VersionNT = 501]]

For SysWow64 I have the condition [CDATA[VersionNT = 601]]

I have found that the DLL will only be inserted on XP systems, but the SysWow64 folder and DLL will be created on both Operating Systems.

I have tried different variations but I can't seem to find where I am going wrong.

I got the condition information from this thread How to check the system is Windows 7 or Windows Server 2008 R2 in Wix Installer?

Image of Deployment Project and Condition


Solution

  • Sorry for the delay, I had to wait 8 hours before I could answer my own question.

    The root problem was a silly mistake.

    I was rebuilding the solution each time after making changes to the deployment project. I should have been right clicking the deployment project and selecting to build that. Thank you for your help.

    I dropped the WIX <!CDATA[ ] parts in the condition field as [Damien_The_Unbeliever][1] said, as well as added the condition to the DLL instead of just the folder.