c00000fd
c00000fd

Reputation: 22275

WiX installer conditional compilation?

I have two builds of my main executable: standard and premium. For simplicity of development they are built from a single solution in Visual Studio by changing a special #define variable.

Now I'm curious if it's possible to do the same with the WiX installer for this project?

I basically need to control the inclusion of only one of the following xml nodes:

1: For standard version MSI:

<Product Name='Foobar 1.0 - Standard' 
    Id='8E9CF27F-B92F-4CB3-BBA0-0AAE5376D5EB' 
    UpgradeCode='20A89269-D206-490D-9134-349594662619'
    Language='1033' 
    Codepage='1252' 
    Version='1.0.0' 
    Manufacturer='Acme Ltd.'>

and later:

<Component Id='MainExecutable' Guid='E1FE2BBE-C72D-4F27-A66D-78417F597D7A'>
 <File Id='FoobarEXE' Name='FoobarAppStandardl10.exe' DiskId='1' Source='FoobarApplStandard10.exe' KeyPath='yes'>

2: For premium version MSI:

<Product Name='Foobar 1.0 - Premium' 
    Id='8E9CF27F-B92F-4CB3-BBA0-0AAE5376D5EC' 
    UpgradeCode='20A89269-D206-490D-9134-34959466261A'
    Language='1033' 
    Codepage='1252' 
    Version='1.0.0' 
    Manufacturer='Acme Ltd.'>

and then:

<Component Id='MainExecutable' Guid='E1FE2BBE-C72D-4F27-A66D-78417F597D7B'>
 <File Id='FoobarEXE' Name='FoobarAppPremiuml10.exe' DiskId='1' Source='FoobarApplPremium10.exe' KeyPath='yes'>

PS. I can obviously make 2 WiX projects... I'm seeking a way to do it in one.

Upvotes: 4

Views: 2001

Answers (2)

Marcos Piedra
Marcos Piedra

Reputation: 1

In my case, i need to pass the symbol compilation to the project that will compile. I solved recompiling and passing the symbols.

For this, edit the wix project e.g. "xx.wixproj", and at the end of the file insert:

<Target Name="MyName" AfterTargets="AfterResolveReferences">
 <MSBuild Projects="Path\xx.csproj" Properties="Configuration=$(Configuration);Platform=$(Platform);DefineConstants=$(DefineConstants)%3bMYSYMBOL;OutputPath=$(OutputPath)" />
</Target>

Unfortunately, this solution in vs 2017 (with .netstandard dlls) and WiX 4, not run.

Upvotes: 0

c00000fd
c00000fd

Reputation: 22275

I found it. Here it is for whoever else is interested.

Upvotes: 4

Related Questions