How to manage Bundle code using preprocessor variables?

I created several configurations of my package project in Visual Studio, and I want to determine which pieces of code should be included in each configuration. My goal is to get several bootloaders: some of them will include prerequisites, and some will not. I tried something like:

<PackageGroup
       Id="Prerequisites">
      <?if $(Configuration)='Release'?>
      <ExePackage
        Id="Netfx4Client"
        Cache="yes"
        Compressed="yes"
        PerMachine="yes"
        Permanent="yes"
        Vital="yes"
        SourceFile=".\SupportFiles\dotNetFx40_Client_x86_x64.exe"
        DetectCondition="NETFRAMEWORK40CLIENT OR (VersionNT64 AND NETFRAMEWORK40CLIENTX64)"
        InstallCondition="(v4.0.30319 > NETFRAMEWORK40CLIENT OR NOT NETFRAMEWORK40CLIENT)  OR (VersionNT64 AND v4.0.30319 > NETFRAMEWORK40CLIENTX64 OR NOT NETFRAMEWORK40CLIENTX64)"
        InstallCommand="/q /norestart  /log [TempFolder]\dotnetframework4.log"/>
<?endif?>

But of course, this is not true. Is it possible to control which pieces of code will be included in the Bundle package chain depending on any variable? Thank.

+5
source share
1 answer

, MSBuild . .wixproj DefineConstants . .wixproj, Votive, Configuration, :

<PropertyGroup>
   <DefineConstants>$(DefineConstants);MyNewVariable=$(MSBuildPropertyName)</DefineConstants>
</PropertyGroup>

, MSBuild , :

<?if $(var.Configuration)="Release" ?>
    Stuff to conditionally compile out
<?endif?>

, , var. . .

+4

All Articles