0

I have an msi that copies files (PLC Code) to a directory(C:\Product\3.1\Boot), and modifies one key.

My visual studio project generates different PLC Code for the different architectures, but the destination is the same on both platforms. They key is in a different spot.

I have looked at using the arch-switch and conditional statements, but these look to only detect the architecture on which it is compiled, and not where the msi is run.

I know that you cant have 32/64 in the same MSI, but I'm not doing anything other than copying files and changing registries. I'm not putting anything in the windows directories/program files.

Though I would like it to appear with a version in the list of programs.

Is it possible in this case to have one installer?

Code '''

<Product Id="*" 
         Name="Company" 
         Language="1033" 
         Version="4.09" 
         Manufacturer="CompanyInc." 
         UpgradeCode="YOUR_GUID"
         >
    <Package Id ="*" 
             InstallerVersion="200" 
             InstallPrivileges="elevated"
             Compressed="yes" 
             InstallScope="perMachine"
             Description="Company PLC Code"
             Manufacturer="CompanyInc."
             Keywords="PLC"
             Comments="F"
             />

    <!--Upgrade/install control-->
    <MajorUpgrade 
                  AllowDowngrades="yes"
                  />

    <!--GUI for install display-->



    <UI>
        <UIRef Id="WixUI_Minimal" />    <!--Define type of UI -->
    </UI>


    <Upgrade Id="GUID_HERE">
        <UpgradeVersion OnlyDetect="no" 
                        Property="SELFFOUND"
                        Minimum="1.0"
                        />
    </Upgrade>


    <MediaTemplate EmbedCab="yes" />

    <!-- Set the icon used in the programs and features list-->
    <Icon Id='ProductIcon' SourceFile='Company.ico' />
    <Property Id='ARPPRODUCTICON' Value='ProductIcon' />


    <!-- Things to install-->
    <Feature Id="Default" Title="PLC Code" Level="1">
        <ComponentGroupRef Id="ProductComponentsx64" />
    </Feature>

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="Company PLC" />
            <Directory Id="BOOTDIR" />
                <Directory Id="PLCDIR" />
        </Directory>

    </Directory>

    <SetDirectory Id="BOOTDIR" Value="C:\CompanySoftware\3.1\Boot" />
    <SetDirectory Id="PLCDIR" Value="C:\CompanySoftware\3.1\Boot\Plc" />


    <!--Specify when actions occur actions during install-->
    <InstallExecuteSequence>
        <Custom Action="ARCHIVEBOOTDIR" After ="CostFinalize"  />
        <!--ToDo: copy files-->
    </InstallExecuteSequence>
</Product>




<Fragment>
    <!--64 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
    <ComponentGroup Id="ProductComponentsx64">
        <Component Id="BootComponents" Guid="" Directory="BOOTDIR">
            <File Id="CurrentConfig.xml" Source="..\_Boot\CompanySoftware RT (x64)\CurrentConfig.xml" KeyPath="no" />
        </Component>
        <Component Id="PLCComponent" Guid="" Directory="PLCDIR">
            <File Id="Port_851.app" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.app" KeyPath="no" />
            <File Id="Port_851.autostart" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.autostart" KeyPath="no" />
            <File Id="Port_851.cid" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.cid" KeyPath="no" />
            <File Id="Port_851.crc" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.crc" KeyPath="no" />
            <File Id="Port_851.occ" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.occ" KeyPath="no" />
            <File Id="Port_851.ocm" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.ocm" KeyPath="no" />
            <File Id="Port_851_boot.tizip" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851_boot.tizip" KeyPath="no" />
        </Component>
        <Component Id="StartupReg" Guid="" Directory="TARGETDIR">
            <RegistryKey Root="HKLM"
                         Key="Software\WOW6432Node\Company\CompanySoftware3\System">
                <RegistryValue Name="SysStartupState"
                               Type="integer"
                               Value ="5"/>
            </RegistryKey>
        </Component>
    </ComponentGroup>
</Fragment>


<Fragment>
    <!--32 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
    <ComponentGroup Id="ProductComponentsx86">
        <Component Id="BootComponents" Guid="" Directory="BOOTDIR">
            <File Id="CurrentConfig.xml" Source="..\_Boot\CompanySoftware RT (x86)\CurrentConfig.xml" KeyPath="no" />
            <File Id="Company.ico" Source="Company.ico" KeyPath="no" />
        </Component>
        <Component Id="PLCComponent" Guid="" Directory="PLCDIR">
            <File Id="Port_851.app" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.app" KeyPath="no" />
            <File Id="Port_851.autostart" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.autostart" KeyPath="no" />
            <File Id="Port_851.cid" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.cid" KeyPath="no" />
            <File Id="Port_851.crc" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.crc" KeyPath="no" />
            <File Id="Port_851.occ" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.occ" KeyPath="no" />
            <File Id="Port_851.ocm" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.ocm" KeyPath="no" />
            <File Id="Port_851_boot.tizip" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851_boot.tizip" KeyPath="no" />
        </Component>
        <Component Id="StartupReg" Guid="" Directory="TARGETDIR">
            <RegistryKey Root="HKLM"
                         Key="Software\Company\CompanySoftware3\System">
                <RegistryValue Name="SysStartupState"
                               Type="integer"
                               Value ="5"/>
            </RegistryKey>
        </Component>
    </ComponentGroup>
</Fragment>

'''

Gene Parmesan
  • 211
  • 2
  • 8
  • 1
    Can you share your wix code? – Pavel Anikhouski Oct 30 '19 at 20:16
  • Hey Pavel, I added the code. My question is more hypothetical as Ive been using WiX for about a day and everything I read indicated that it wasnt possible. – Gene Parmesan Oct 31 '19 at 20:21
  • A 64-bit installer can install 32-bit components and files, however a 64-bit installer can not run on an x86 system (ancient machines by now). A 32-bit installer can run on a 64-bit system. The question is if you need to support downstream machines? – Stein Åsmul Oct 31 '19 at 21:38
  • We do have a few x86 machines, but should not in the future. Im not entirely clear on what an 'install' actually entails. All I want to do is copy these files, change that registry and make an entry in the 'add/remove program' list. In the future I would like to start/stop some services but I don't want to install any. My installer would need to know which system its being run on as the files generated for the 32bit are different than the ones for the 64 bit. I'm not a software guy, so my knowledge is limited. Just learning now. – Gene Parmesan Oct 31 '19 at 22:52
  • Here are a couple of links. Please check them out: [Create installer with dependencies for x64 and x86](https://stackoverflow.com/q/55170467/129130). [Some information on bitness](https://stackoverflow.com/a/56298909/129130). – Stein Åsmul Nov 01 '19 at 12:54
  • Thanks Stein, these links were a huge help. So, in theory, I should be able to create a 32bit installer and it will run on both systems. All I need to figure out is how to detect which architecture the installer is running on, and place the proper files and set the registry. – Gene Parmesan Nov 14 '19 at 18:43

1 Answers1

0

I was able to figure out how to get this to work. By using the Condition and ![CDATA[NOT(VersionNT64)]] to detect the version I was able to perform different actions!

<Product Id="*"
         Name="Company PLC"
         Language="1033"
         Version="4.09"
         Manufacturer="Company Inc."
         UpgradeCode="Code"
         >
    <Package Id ="*"
             InstallerVersion="200"
             InstallPrivileges="elevated"
             Compressed="yes"
             InstallScope="perMachine"
             Description="Company CompanySoftware PLC Code"
             Manufacturer="Company Inc."
             Keywords="PLC"
             Comments="Company "
             />

    <!--Upgrade/install control-->
    <MajorUpgrade
                  AllowDowngrades="yes"
                  />

    <!--GUI for install display-->

    <!-- future use for custom graphics on the MSI pages
    <WixVariable Id="WixUIBannerBmp" Value="CompanyWixUIBanner.bmp" />
    <WixVariable Id="WixUIDialogBmp" Value="CompanyWixUIBanner.bmp" />
    -->

    <UI>
        <UIRef Id="WixUI_Minimal" />
        <!--Define type of UI -->
    </UI>


    <Upgrade Id="CODE">
        <UpgradeVersion OnlyDetect="no"
                        Property="SELFFOUND"
                        Minimum="1.0"
                        />
    </Upgrade>


    <MediaTemplate EmbedCab="yes" />

    <!-- Set the icon used in the Windows programs and features list-->
    <Icon Id='ProductIcon' SourceFile='Company.ico' />
    <Property Id='ARPPRODUCTICON' Value='ProductIcon' />


    <!-- Things to install- This would normally appear as the selectable list of items to install in a regular installer-->
    <Feature Id="Default_x64" Title="PLC Code x64" Level="1">
        <Condition Level ="1">
            <![CDATA[(VersionNT64)]]>
        </Condition>
            <ComponentGroupRef Id="ProductComponentsx64" />
    </Feature>

    <Feature Id="Default_x86" Title="PLC Code x86" Level="1">
        <Condition Level ="1">
            <![CDATA[NOT(VersionNT64)]]>
        </Condition>
        <ComponentGroupRef Id="ProductComponentsx86" />
    </Feature>


    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="Company PLC" />
            <Directory Id="BOOTDIR" />
            <Directory Id="PLCDIR" />
        </Directory>

    </Directory>

    <SetDirectory Id="BOOTDIR" Value="C:\CompanySoftware\3.1\Boot" />
    <SetDirectory Id="PLCDIR" Value="C:\CompanySoftware\3.1\Boot\Plc" />


</Product>




<Fragment>
    <!--64 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
    <ComponentGroup Id="ProductComponentsx64">
        <Component Id="BootComponentsx64" Guid="" Directory="BOOTDIR">
            <Condition>
                <![CDATA[(VersionNT64)]]>
            </Condition>
            <File Id="CurrentConfig.xml.x64" Source="..\_Boot\CompanySoftware RT (x64)\CurrentConfig.xml" KeyPath="no" />
        </Component>
        <Component Id="PLCComponent.x64" Guid="" Directory="PLCDIR">
            <Condition>
                <![CDATA[(VersionNT64)]]>
            </Condition>
            <File Id="Port_851.app.x64" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.app" KeyPath="no" />
        </Component>
        <Component Id="StartupReg.x64" Guid="" Directory="TARGETDIR">
            <Condition>
                <![CDATA[(VersionNT64)]]>
            </Condition>
            <RegistryKey Root="HKLM"
                         Key="Software\WOW6432Node\Company\CompanySoftware\System">
                <RegistryValue Name="SysStartupState"
                               Type="integer"
                               Value ="5"/>
            </RegistryKey>
        </Component>
    </ComponentGroup>
</Fragment>


<Fragment>
    <!--32 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
    <ComponentGroup Id="ProductComponentsx86">
        <Component Id="BootComponentsx86" Guid="" Directory="BOOTDIR">
            <Condition>
                <![CDATA[NOT(VersionNT64)]]>
            </Condition>
            <File Id="CurrentConfig.xml.x86" Source="..\_Boot\CompanySoftware RT (x86)\CurrentConfig.xml" KeyPath="no" />
        </Component>
        <Component Id="PLCComponentx86" Guid="" Directory="PLCDIR">
            <Condition>
                <![CDATA[NOT(VersionNT64)]]>
            </Condition>
            <File Id="Port_851.app.x86" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.app" KeyPath="no" />
        </Component>
        <Component Id="StartupReg.x86" Guid="" Directory="TARGETDIR">
            <Condition>
                <![CDATA[NOT(VersionNT64)]]>
            </Condition>
            <RegistryKey Root="HKLM"
                         Key="Software\Company\CompanySoftware\System">
                <RegistryValue Name="SysStartupState"
                               Type="integer"
                               Value ="5"/>
            </RegistryKey>
        </Component>
    </ComponentGroup>
</Fragment>

Gene Parmesan
  • 211
  • 2
  • 8