WiX インストール セットを同じフォルダーにアップグレードする

StackOverflow https://stackoverflow.com/questions/55964

  •  09-06-2019
  •  | 
  •  

質問

で構築されたインストール セット (MSI) にメジャー アップグレードするにはどうすればよいですか? WiX 元のインストールと同じフォルダーにインストールしますか?

インストールはアップグレードとして正しく検出されますが、ディレクトリ選択画面は引き続きデフォルト値 (現在のインストール フォルダーとは限りません) で表示されます。

最初のインストール時にインストールフォルダーをレジストリキーに保存し、アップグレード時にこのキーを読み取るなどの手動作業を行う必要がありますか?もしそうなら、何か例はありますか?

それともこれを達成するためのより簡単な方法はありますか MSI それともWiX?

参考として、私の現在の WiX ファイルは次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
    <Product Id="a2298d1d-ba60-4c4d-92e3-a77413f54a53"
             Name="MyCompany Integration Framework 1.0.0"
             Language="1033"
             Version="1.0.0"
             Manufacturer="MyCompany"
             UpgradeCode="9071eacc-9b5a-48e3-bb90-8064d2b2c45d">

        <!-- Package information -->
        <Package Keywords="Installer"
                 Id="e85e6190-1cd4-49f5-8924-9da5fcb8aee8"
                 Description="Installs MyCompany Integration Framework 1.0.0"
                 Comments="Installs MyCompany Integration Framework 1.0.0"
                 InstallerVersion="100"
                 Compressed="yes" />

        <Upgrade Id='9071eacc-9b5a-48e3-bb90-8064d2b2c45d'>
            <UpgradeVersion Property="PATCHFOUND"
                            OnlyDetect="no"
                            Minimum="0.0.1"
                            IncludeMinimum="yes"
                            Maximum="1.0.0"
                            IncludeMaximum="yes"/>
        </Upgrade>

        <!-- Useless but necessary... -->
        <Media Id="1" Cabinet="MyCompany.cab" EmbedCab="yes" />

        <!-- Precondition: .NET 2 must be installed -->
        <Condition Message='This setup requires the .NET Framework 2 or higher.'>
            <![CDATA[MsiNetAssemblySupport >= "2.0.50727"]]>
        </Condition>

        <Directory Id="TARGETDIR"
                   Name="SourceDir">
            <Directory Id="MyCompany"
                       Name="MyCompany">
                <Directory Id="INSTALLDIR"
                           Name="Integrat"
                           LongName="MyCompany Integration Framework">
                    <Component Id="MyCompanyDllComponent"
                               Guid="4f362043-03a0-472d-a84f-896522ce7d2b"
                               DiskId="1">
                        <File Id="MyCompanyIntegrationDll"
                              Name="IbIntegr.dll"
                              src="..\Build\MyCompany.Integration.dll"
                              Vital="yes"
                              LongName="MyCompany.Integration.dll" />
                        <File Id="MyCompanyServiceModelDll"
                              Name="IbSerMod.dll"
                              src="..\Build\MyCompany.ServiceModel.dll"
                              Vital="yes"
                              LongName="MyCompany.ServiceModel.dll" />
                    </Component>

                    <!-- More components -->
                </Directory>
            </Directory>
        </Directory>

        <Feature Id="MyCompanyProductFeature"
                 Title='MyCompany Integration Framework'
                 Description='The complete package'
                 Display='expand'
                 Level="1"
                 InstallDefault='local'
                 ConfigurableDirectory="INSTALLDIR">
            <ComponentRef Id="MyCompanyDllComponent" />
        </Feature>

        <!-- Task scheduler application. It has to be used as a property -->
        <Property Id="finaltaskexe"
                  Value="MyCompany.Integration.Host.exe" />
        <Property Id="WIXUI_INSTALLDIR"
                  Value="INSTALLDIR" />

        <InstallExecuteSequence>
            <!-- command must be executed: MyCompany.Integration.Host.exe /INITIALCONFIG parameters.xml -->
            <Custom Action='PropertyAssign'
                    After='InstallFinalize'>NOT Installed AND NOT PATCHFOUND</Custom>
            <Custom Action='LaunchFile'
                    After='InstallFinalize'>NOT Installed AND NOT PATCHFOUND</Custom>

            <RemoveExistingProducts Before='CostInitialize' />
        </InstallExecuteSequence>

        <!-- execute comand -->
        <CustomAction Id='PropertyAssign'
                      Property='PathProperty'
            Value='[INSTALLDIR][finaltaskexe]' />
        <CustomAction Id='LaunchFile'
                      Property='PathProperty'
                      ExeCommand='/INITIALCONFIG "[INSTALLDIR]parameters.xml"'
                      Return='asyncNoWait' />

        <!-- User interface information -->
        <UIRef Id="WixUI_InstallDir" />
        <UIRef Id="WixUI_ErrorProgressText" />
    </Product>
</Wix>
役に立ちましたか?

解決

WiX チュートリアルに例があります。 http://wix.tramontana.co.hu/tutorial/getting-started/where-to-install

<Property Id="INSTALLDIR">
  <RegistrySearch Id='AcmeFoobarRegistry' Type='raw'
    Root='HKLM' Key='Software\Acme\Foobar 1.0' Name='InstallDir' />
</Property>

もちろん、インストールの一部としてレジストリ キーも設定する必要があります。これを元のインストールの一部であるコンポーネント内に貼り付けます。

<RegistryKey
         Key="Software\Software\Acme\Foobar 1.0"
         Root="HKLM">
  <RegistryValue Id="FoobarRegInstallDir"
             Type="string"
             Name="InstallDir"
             Value="[INSTALLDIR]" />
</RegistryKey> 

他のヒント

「レジストリ」は廃止されました。コードのその部分は次のようになります。

<RegistryKey Id="FoobarRegRoot"
             Action="createAndRemoveOnUninstall"
             Key="Software\Software\Acme\Foobar 1.0"
             Root="HKLM">
  <RegistryValue Id="FoobarRegInstallDir"
                 Type="string"
                 Name="InstallDir"
                 Value="[INSTALLDIR]" />
</RegistryKey>

このような単純なケースでは、RegistryKey を RegistryValue から分離する必要はありません。また、HKLM の代わりに HKMU を使用すると、マシン インストールを行う場合でもユーザー インストールを行う場合でも処理されます。

<RegistryValue
  Root="HKMU"
  Key="Software\[Manufacturer]\[ProductName]"
  Name="InstallDir"
  Type="string"
  Value="[INSTALLDIR]"
  KeyPath="yes" />
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top