バージョン 1.0.0 と V2.0.0 の製品 A があり、それぞれが WiX ファイルの関連付けを使用してファイル タイプ xyz (実行可能な product.exe) に関連付けられています。製品 A V1.0.0 をインストールすると、ファイル拡張子 xyz が関連付けられます。次に、製品 A V2.0.0 をインストールします。これで、ファイル xyz が製品 A V2.0.0 に関連付けられます。最初に 2.0.0 がインストールされ、その後に V1.0.0 がインストールされている場合、ファイルの関連付けは期待どおりにオーバーライドされます。
V2.0.0 をアンインストールすると、2.0.0 のファイルの関連付けが削除され、V1.0.0 の関連付けが復元されず、その逆も同様です。
WiX を使用して以前のバージョンのファイルの関連付けを自動的に復元するにはどうすればよいですか? 以下の私の WiX コードを見て、可能な修正を提案してください。
製品 A V1.0.0 WiX 3.8 コード:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="PUT-GUID-HERE" Name="Product A 1.0" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="PUT-GUID-HERE">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="Product A 1.0" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Product A 1.0" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent" Guid="PUT-GUID-HERE">
<File Id="openBox" Source="D:\open-box.ico" />
<File Id="wpfFile" Source="D:\product.exe" />
<ProgId Advertise="no" Description="My WPF File" Icon="openBox" Id="xyzFileAssociation_1_0">
<Extension Id="xyz" ContentType="application/xyz">
<Verb Id="open" Command="open with my app" Argument=""%1" "1.0.0"" TargetFile="wpfFile"/>
</Extension>
</ProgId>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
製品 A V2.0.0 WiX 3.8 コード:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="PUT-GUID-HERE" Name="Product A 2.0" Language="1033" Version="2.0.0.0" Manufacturer="Microsoft" UpgradeCode="PUT-GUID-HERE">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="Product A 2.0" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Product A 2.0" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent" Guid="PUT-GUID-HERE">
<File Id="openBox" Source="D:\open-box.ico" />
<File Id="wpfFile" Source="D:\product.exe" />
<ProgId Advertise="no" Description="My WPF File" Icon="openBox" Id="xyzFileAssociation_2_0">
<Extension Id="xyz" ContentType="application/xyz">
<Verb Id="open" Command="open with my app" Argument=""%1" "2.0.0"" TargetFile="wpfFile"/>
</Extension>
</ProgId>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
唯一の違いは、ProgId の Id wrt ファイルの関連付けにあります。