Wix:添加我收集的热量文件

时间:2015-11-04 18:53:10

标签: wix heat

过去几天我一直在与Wix挣扎,到目前为止,可能已经在网上阅读了15个指南,试图让它在我的实际应用程序上工作,但没有运气。

我使用了一个小而简单的其他项目来练习并确保我理解并做好每件事。

guide之后我设法让它工作,下一个阶段是尝试将目录的内容添加到安装中,因为它包含许多我不想手动添加的文件。

所以关注这个guide我使用heat.exe来收集文件夹的内容,我得到了热量来创建我需要的.wxs,但接下来是尝试将其内容添加到我的Product.wxs文件中

问题在于它说我应该添加这个:

<!-- Add ComponentGroupRef to existing Feature, or create new one -->
<!-- Notice the IDs & what we used in heat -->
<Feature Id="ProductFeature" Title="Main product" Level="1">
<ComponentGroupRef Id="ConfigurationUtilityComponents"/>
</Feature>

<Fragment>
<Directory Id="INSTALLDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="ConfigurationUtilityDir" Name="ConfigurationUtility" />
  </Directory>
</Directory>
</Fragment>

到我的Product.wxs文件,但我似乎无法弄清楚如何做到这一点。 任何人都可以帮忙吗?

这是我的Product.wxs文件:

<Product Id="8748CF04-E8D3-4A2B-B3F5-22E50B3A8E49"
       Name="MyApp" Language="1033" Version="1.0.0.0" Manufacturer="My System Pvt Ltd"
       UpgradeCode="8748CF04-E8D3-4A2B-B3F5-22E50B3A8E49">

<Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
          InstallPrivileges="elevated" ReadOnly="yes"/>

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!--Add Cab1.cab File inside the Package-->
<Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" />

<!--Here We Install Our Main App-->
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLFOLDER" Name="MY System Pvt Ltd"/>
  </Directory>

  <!-- Step 1: For the Program Menu -->
  <Directory Id="ProgramMenuFolder">
    <Directory Id="ApplicationProgramsFolder" Name="My System Pvt Ltd"/>
  </Directory>

  <!--Step 2:For Desktop Folder-->
  <Directory Id="DesktopFolder"/>

  <!--Step 3:For StartUp Folder-->
  <Directory Id="StartupFolder"/>

</Directory>

<!--Step 4 :Add Main App exe-->
<DirectoryRef Id="INSTALLFOLDER">
  <Component Id="myapplication.exe" Guid="84C5B9E8-FD90-4EA8-A502-B08AC9B38D39">
    <File Source="$(var.WpfApplication2.TargetPath)" Name="MYApp.exe"
          Id="MyAppEXE" KeyPath="yes"/>
  </Component>
</DirectoryRef>

<!-- Step 1.1: Add the shortcut to your installer package Program Menu or Start Menu-->
<DirectoryRef Id="ApplicationProgramsFolder">
  <Component Id="ApplicationShortcut" Guid="1A437020-D5C9-450C-9B3D-33957994780A">
    <!--Add Shortcut of the Application in start Menu-->
    <Shortcut Id="ApplicationStartMenuShortcut" Name="MyApp" Description="My Application Description"
        Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER">
      <!--Add Icon to the ShortCut-->
      <Icon Id="MYPMenuIcon"  SourceFile=".\Desktop.ico" />
    </Shortcut>
    <!--Remove the Folder At time of Uninstall-->
    <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
    <RegistryValue Root="HKCU"  Key='Software\[Manufacturer]\[ProductName]'
                   Name="installed" Type="integer" Value="1" KeyPath="yes"/>
  </Component>
</DirectoryRef>

<!-- Step 2.1: Add the shortcut to your installer package For DeskTop-->
<DirectoryRef Id="DesktopFolder">
  <Component Id="ApplicationDeskShortcutComp" Guid="40127963-856D-460D-9E1B-4C10EB65835B">
    <Shortcut Id="ApplicationDeskShortcut" Name="MYAppDesk"
              Description="My Application Description" Target="[INSTALLFOLDER]MyApp.exe"
              WorkingDirectory="INSTALLFOLDER">
      <Icon Id="MYDeskIcon"  SourceFile=".\Desktop.ico" />
    </Shortcut>
    <RemoveFolder Id="DesktopFolder" On="uninstall"/>
    <RegistryValue Root="HKCU"  Key='Software\[Manufacturer]\[ProductName]'
                   Name="installed" Type="integer" Value="1" KeyPath="yes"/>
  </Component>
</DirectoryRef>

<!--Step 3.1: add Shortcut to StartUp Folder to run application when you login-->
<DirectoryRef Id="StartupFolder">
  <Component Id="ApplicationStartUpShortcutComp" Guid="843B6A2E-AB61-40C7-BE49-FBCD7F81E35D">
    <Shortcut Id="ApplicationStartUpDeskShortcut" Name="MYAppDesk" Description="My Application Description"
        Target="[INSTALLFOLDER]MyApp.exe" WorkingDirectory="INSTALLFOLDER">
      <Icon Id="MyIconStartUp"  SourceFile=".\Desktop.ico" />
    </Shortcut>
    <RemoveFolder Id="StartupFolder" On="uninstall"/>
    <RegistryValue Root="HKCU"  Key='Software\[Manufacturer]\[ProductName]'  
                   Name="installed" Type="integer" Value="1" KeyPath="yes"/>
  </Component>
</DirectoryRef>

<!--Add Component-->
<Feature Id="MainApplication" Title="Main Application" Level="1">
  <ComponentRef Id="myapplication.exe" />
  <!--Step 1.2:Add Start menu or program  Shortcut-->
  <ComponentRef Id="ApplicationShortcut" />
  <!--step 2.2Add DeskTop Shortcut-->
  <ComponentRef Id="ApplicationDeskShortcutComp" />
  <!--step 3.2Add DeskTop Shortcut-->
  <ComponentRef Id="ApplicationStartUpShortcutComp"/>
  <ComponentRef Id="dotNetClass.Output" />
  <!--<ComponentRef Id="AU" />-->
</Feature> 
</Product>

1 个答案:

答案 0 :(得分:0)

我有点得到你的来源,我试图将我的Heat产生的代码链接到产品.wxs文件..我做的是,将热源代码(.wxs)文件添加到你的项目..

在第一个Component组上,记下名称,例如

<ComponentGroup Id="SampleGroup">

然后在本节

    <Feature Id="ProductFeature" Title="Random Desktop" Level="1">
        <ComponentGroupRef Id="SampleGroup" />
    </Feature>
</Product>

确保两个名称匹配,其中显示“SampleGroup”