0

私は WIX の経験があまりない (これが初めての経験です) ので、VS 2012 の SharpSetup テンプレートを使用してすぐに起動して実行することにしました。今私の問題は、ユーザーがアプリを使用するために.netをユーザーのマシンにインストールする必要があることですが、ここで見つけたすべての回答は「チェーン」の使用について語っています。繰り返しますが、これ以外の場所はわかりません。.exe と同じフォルダーに入れている .net インストーラーを想定していますが、現時点では何かに取り組んでいます。プロジェクトと同じグループに .net インストーラー exe を含めることで、この問題を解決しようとして失敗したことがわかります。誰かがこの.netチェック/インストールをコードのどこに実装するかを説明できれば、とても感謝しています!

これが私のWIXです:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include Product.Defines.wxi ?>



<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramMenuFolder" Name="Programs">
    <Directory Id="ProgramMenuDir" Name="!(loc.APPNAME)">
      <Component Id="pmd" Guid="{9d848b50-cab5-4f96-abe3-4c551c7335db}">
        <RegistryValue Root="HKCU" Key="SOFTWARE\$(var.AppCode)\ProgramMenuDir" Type="string" Value="ProgramMenuDir" KeyPath="yes" />
        <RemoveFolder Id="ProgramMenuDirRF" On="uninstall" />
      </Component>
    </Directory>
  </Directory>
  <Directory Id="DesktopFolder" Name="Desktop" />
  <Directory Id="StartupFolder" Name="Startup" />
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLLOCATION" Name="$(var.AppCode)">
      <Component Id="MainExecutable" Guid="{bbd95e2b-9f33-4c67-80d9-9b80f3f52001}">
        <File Id="MainExecutableFile" Name="SampleApp.exe" Source="..\ProductBuild\sampleFile.txt" KeyPath="yes">
          <Shortcut Id="MainExecutableStartMenu" Directory="ProgramMenuDir" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes"/>
          <Shortcut Id="MainExecutableDesktop" Directory="DesktopFolder" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes" />
        </File>
      </Component>
      <Component Id="SubFeatureExecutable" Guid="{0b30137e-621e-49a1-83bb-d0b50c3834b8}">
        <File Id="SubFeatureExecutableFile" Name="SampleLibrary.dll" Source="..\ProductBuild\sampleFile.txt" Vital="yes" />
      </Component>
      <Component Id="DocumentationPound" Guid="{006f5e3e-bb68-409c-8c30-37dc82a0a3f9}">
        <File Id="DocumentationPoundFile" Name="Pound.currency" Source="..\ProductBuild\sampleFile.txt" Vital="yes" />
      </Component>
      <Component Id="DocumentationEuro" Guid="{a1e06fa0-0293-4314-ad3b-5a82b7cde17e}">
        <File Id="DocumentationEuroFile" Name="Euro.currency" Source="..\ProductBuild\sampleFile.txt" Vital="yes" />
      </Component>
      <Component Id="DocumentationCommon" Guid="{578635b1-b912-428e-b161-3507465bced9}">
        <File Id="DocumentationCommonFile" Name="help.exe" Source="..\ProductBuild\sampleFile.txt" Vital="yes" />
      </Component>
      <Component Id="DocumentationEnglish" Guid="{434f103e-7be8-49ac-b90b-9675f42e6caa}">
        <File Id="DocumentationEnglishFile" Name="English.documentation" Source="..\ProductBuild\sampleFile.txt" Vital="yes" />
      </Component>
      <Component Id="DocumentationFrench" Guid="{bd132536-94c6-488d-aa8a-700d4070718f}">
        <File Id="DocumentationFrenchFile" Name="French.documentation" Source="..\ProductBuild\sampleFile.txt" Vital="yes" />
      </Component>
      <Component Id="DocumentationGerman" Guid="{045e065e-bc43-418d-97fc-701b0d80dca3}">
        <File Id="DocumentationGermanFile" Name="German.documentation" Source="..\ProductBuild\sampleFile.txt" Vital="yes" />
      </Component>
    </Directory>
  </Directory>
</Directory>
<DirectoryRef Id="INSTALLLOCATION">
  <Component Id="dotNetFx40_Full_x86_x64.exe" Guid="{c5e5282e-dafe-4e51-857f-2648bbcb743c}">
    <File Id="fil8a9sd8fa9s8df9a8fs98fd9sfa908sdf" KeyPath="yes" Source="..\ProductBuild\dotNetFx40_Full_x86_x64.exe" />
  </Component>
  <Component Id="EntityFramework.dll" Guid="{C8010F46-05CF-4D73-8F69-6F68176EC558}">
    <File Id="fil34ECF92861B5C4F79E50A3EE293AC68A" KeyPath="yes" Source="..\ProductBuild\EntityFramework.dll" />
  </Component>
  <Component Id="EntityFramework.xml" Guid="{C68D3DE4-D338-4C83-96F1-DCF7D1FA1AAC}">
    <File Id="fil04EFBF6DC1A33030A49CFCE8889F7E70" KeyPath="yes" Source="..\ProductBuild\EntityFramework.xml" />
  </Component>
  <Component Id="PetesTimeTray.exe" Guid="{C1891D2B-9815-42A3-BCD7-3316F0F28AC7}">
    <File Id="fil7AC61C1EB5B94A1F447DA90D87BB454B" KeyPath="yes" Source="..\ProductBuild\PetesTimeTray.exe">
      <Shortcut Id="PetesTimeTrayStartMenu" Directory="ProgramMenuDir" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes" />
      <Shortcut Id="PetesTimeTrayDesktop" Directory="DesktopFolder" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes" />
      <Shortcut Id="PetesTimeTrayStartUp" Directory="StartupFolder" Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" Icon="icon.ico" IconIndex="0" Advertise="yes" />
    </File>
  </Component>
  <Component Id="PetesTimeTray.exe.config" Guid="{321EFADC-29DD-4E41-BED0-5B360FAEBBA0}">
    <File Id="fil1DC527512D4271328F383F45C1F9229B" KeyPath="yes"    Source="..\ProductBuild\PetesTimeTray.exe.config" />
  </Component>
</DirectoryRef>
<ComponentGroup Id="PetesTimeTrayFiles">
  <ComponentRef Id="dotNetFx40_Full_x86_x64.exe" />
  <ComponentRef Id="EntityFramework.dll" />
  <ComponentRef Id="EntityFramework.xml" />
  <ComponentRef Id="PetesTimeTray.exe" />
  <ComponentRef Id="PetesTimeTray.exe.config" />
</ComponentGroup>
</Fragment>
</Wix>
4

1 に答える 1

1

.NET フレームワークがインストールされているかどうかは、NetFxExtension に light でリンクすることで確認できます。必要なものに a を追加するPropertyRefだけです。これらのプロパティのリストは、こちらで確認できます。

ソフトウェアをインストールする前に .NET Framework 4.0 Full が存在することを確認したい場合は、ソース コードのどこかに次のように追加します。

<PropertyRef Id="NETFRAMEWORK40FULL" />
<Condition Message=".NET Framework 4.0 Full is not installed.">
    NETFRAMEWORK40FULL
</Condition>

MSI を実行すると、LaunchConditionsアクションが実行され、NETFRAMEWORK40FULLプロパティが設定されているかどうかが確認されます。そうである場合、インストールは続行されます。そうでない場合、インストールは失敗します。

ただし、事前に .NET Framework をインストールする場合は、2 つの WiX プロジェクトが必要になります。1 つは基本的な MSI 用で、もう 1 つはバンドル用です (これはあなたが聞いたチェーンです)。それを行う方法についてのチュートリアルがここにあります。

<Bundle>

    ...

    <Chain>
        <PackageGroupRef Id="NetFx40Redist"/>
        <MsiPackage Id="MyApplication" SourceFile="path to your msi"/>
    </Chain>
</Bundle>

ここでも NetFxExtension にリンクする必要があります。可能な .NET パッケージのリストは、ここにリストされています。

于 2013-08-24T01:11:33.450 に答える