0

私が書いているインストーラーにVisual C++ 2012パッケージをインストールさせようとしているので、エンドユーザーは個別に行う必要がありません。

実行可能ファイルはインストール ディレクトリにありますが、インストーラをビルドすると、システムがファイルを見つけられないというエラーが表示されます。

問題のインストーラーの部分に関連するコードのチャンクを次に示します。間違いが多い場合はあらかじめご了承ください。WiX に慣れ始めたばかりです。

<Binary Id="MyVC" SourceFile="[INSTALLDIR]vcredist_x64.exe"/>
<CustomAction   Id='VCInstall'
                BinaryKey="MyVC"
                ExeCommand='/quiet'
                Execute='deferred' 
                Return='ignore'/>

<InstallExecuteSequence>
    <Custom Action="VCInstall" Before="InstallFinalize" ></Custom>
</InstallExecuteSequence>
4

2 に答える 2

1

これを行う最善の方法は、ブートストラップを使用したくない場合、マージ モジュールを使用することです。必要なことを行うには、カスタム アクションを使用してバイナリ ファイルからデータを抽出し、それをターゲット マシン上の場所にある新しいファイルに書き込み、セットアップを実行する必要があります。これは MSI のベスト プラクティスには従いません。しかし、あなたがこの道を進みたいのなら、私はあなたを助けることができます. これは私がプロジェクトにそれらを追加する方法であり、それらはインストール中にインストールされますInstallExecuteSequence

    <!-- Including the 64-bit redistributables if the platform is 64-bit -->
<?if $(var.Platform) = x64 ?>
<DirectoryRef Id="TARGETDIR">
  <Merge Id="Microsoft_VC110_CRT_x64" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_CRT_x64.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_ATL_x64" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_ATL_x64.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_MFC_x64" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_MFC_x64.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_MFCLOC_x64" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_MFCLOC_x64.msm" Language="0" DiskId="1"/>
</DirectoryRef>

<Feature Id="VCRedistx64" Display="hidden" Level="1">
  <MergeRef Id="Microsoft_VC110_CRT_x64"/>
  <MergeRef Id="Microsoft_VC110_ATL_x64"/>
  <MergeRef Id="Microsoft_VC110_MFC_x64"/>
  <MergeRef Id="Microsoft_VC110_MFCLOC_x64"/>
</Feature>
<?endif ?>

<!--Installing 32-bit Visual C++ 2012 Redistributables-->
<?if $(var.Platform) = x86 ?>
<DirectoryRef Id="TARGETDIR">
  <Merge Id="Microsoft_VC110_CRT_x86" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_CRT_x86.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_ATL_x86" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_ATL_x86.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_MFC_x86" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_MFC_x86.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_MFCLOC_x86" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_MFCLOC_x86.msm" Language="0" DiskId="1"/>
</DirectoryRef>

<Feature Id="VCRedist" Display="hidden" Level="1">
  <MergeRef Id="Microsoft_VC110_CRT_x86"/>
  <MergeRef Id="Microsoft_VC110_ATL_x86"/>
  <MergeRef Id="Microsoft_VC110_MFC_x86"/>
  <MergeRef Id="Microsoft_VC110_MFCLOC_x86"/>
</Feature>
<?endif ?>
于 2013-01-17T14:12:29.433 に答える
0

これは、VC 再頒布可能パッケージをマージ モジュールとして含む Qt5 アプリケーションのインストーラーの完全な例です。

于 2013-11-13T08:05:30.477 に答える