WiX 3.8 MSI for a 32-bit and a 64-bit machine
Вопрос
I have Visual Studio 2012, WiX 3.8 setup project and Burn bootstrapper. Everything works fine if I target a 32-bit machine. I want to create two separate MSI files for 32-bit and 64-bit with localizations. But, I cannot find a 64-bit target option in configuration manager. So, I manually created an x64 target and tried compiling the setup project. But it fails completely. I'm not able to include the following file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<?include $(var.ProjectDir)\Includes\Variables.wxi ?>
<Fragment>
<CustomAction somecustomaction />
...
More custom actions...
...
</Fragment>
</Wix>
The error I get is:
Error 33 Schema validation failed with the following error at line 1, column 206: The element 'Wix' in namespace 'http://schemas.microsoft.com/wix/2006/wi' cannot contain text. List of possible elements expected: 'Bundle Product Module Patch Fragment PatchCreation'. somefile.wxs 2 1 Some.Installer Installer_x64\Some.Installer)
When I remove the include tag, then it compiles. But I need to use such include directives in other files where I reference some variables. I don't really understand the issue here. The include tag works perfectly for 32-bit, then why it is throwing an error if I use it with a 64-bit target? What is the issue here?
Are there any best practices for creating setups for different platforms? I'm also using the Burn bootstrapper and localizations for English and German. I have gone through similar questions on Stack Overflow, but no help so far.
Решение
The error was in the project file. In my menu Build -> Configuration Manager, I have set the Active build configuration as Release|x64. However, Visual Studio din't automatically change my project file content to Release|x64.
When I manually edited the project file, I changed the platform to x64, but I missed to change the configuration to Release. It was in Debug|x64 mode and my Visual Studio installation was trying to compile in Release|x64 mode. Now, the error is resolved and my setup is compiling when I edited my project file manually to Release|x64.
However, I still don't understand why candle.exe gave me this error when it was Visual Studio 2012's problem as far as I know. Somebody correct me if I'm wrong.
Другие советы
I've got pretty much the same setup as you (WiX 3.8, targeting two different platforms, including a "Variables.wxi" file, ...), and it is working perfectly fine. My best guess would be that something is wrong in your Variables.wxi.
To switch some values based on the target platform, use the $(var.Platform)
variable:
<!-- x86 / x64 switch -->
<?if $(var.Platform)=x64 ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define Win64 = "yes"?>
<?define ProductName = "Datacard EzPrint Plugin (64 bit)" ?>
<?else ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define Win64 = "no"?>
<?define ProductName = "Datacard EzPrint Plugin" ?>
<?endif ?>
Move your Include
tag outside the Wix
tag.
The error is telling you that there is invalid content inside the Wix
tag.