簡體   English   中英

32/64 位 WiX 組合安裝程序 - 僅復制文件

[英]32/64 bit WiX Combined Installer-Copying files only

我有一個將文件(PLC 代碼)復制到目錄(C:\Product\3.1\Boot)並修改一個鍵的 msi。

我的 Visual Studio 項目為不同的架構生成不同的 PLC 代碼,但目標在兩個平台上是相同的。 他們的鑰匙在不同的地方。

我已經研究過使用 arch-switch 和條件語句,但這些看起來只檢測編譯它的架構,而不是運行 msi 的位置。

我知道您不能在同一個 MSI 中使用 32/64,但除了復制文件和更改注冊表之外,我沒有做任何事情。 我沒有在 windows 目錄/程序文件中添加任何內容。

雖然我希望它與程序列表中的版本一起出現。

在這種情況下是否可以有一個安裝程序?

代碼 '''

<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>

'''

我能夠弄清楚如何讓它發揮作用。 通過使用 Condition 和 ![CDATA[NOT(VersionNT64)]] 來檢測我能夠執行不同操作的版本!

<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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM