One MSI for 32-bit and 64-bit

2019-06-07 06:17发布

问题:

Can anyone give me a good example or set me on the correct direction to enable my installers for 32-bit and 64-bit. I am using Wix 3.6.

I have tried this:

<?if $(var.Platform) = x64 ?>
<?define ProductName = "InsomniacGeek: Windows Setup Test (64 bit)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define ProductName = "InsomniacGeek: Windows Setup Test" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>


<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="$(var.Platform)" />

It doesn't like this however, its says the Platform attribute is invalid, has anyone got this functioning and could help me please?

回答1:

That's exactly the way I do it, and it works perfectly well.

You get a squiggly line and a warning in Votive because the literal text $(var.Platform) isn't one of the platform enumeration values defined in the XML Schema for WiX source files. Once the preprocessor finishes with the file, the attribute's value is valid and candle will happily accept it.

Edited to add: This question and its answers are a great WiX resource.