【问题标题】:Wix Installer start menu shortcut not appearingWix Installer 开始菜单快捷方式未出现
【发布时间】:2013-01-29 12:59:40
【问题描述】:

出于学习目的,我正在尝试使用 WiX v3.7(因为 VS2012 不再包括设置和部署项目)为 Windows 应用程序创建安装程序项目。 Wix 工具集已集成到 VS,我正在创建一个新的 WiX 单一安装程序设置项目。安装程序总是成功编译(图标扩展中的警告除外),它运行完美并按原样放置桌面快捷方式,但未能在 Windows 7 Professional x64 Service Pack 1 上放置正确的开始菜单快捷方式。 我在网上搜索并尝试了几乎所有我看到的东西,但到目前为止还没有成功。 product.wxs 文件如下,“my_guid”字符串替换为项目中适当的 GUIDS。显然我错过了一点,但看不到在哪里。注册表项也未创建,因此最后一个片段可能出于某种原因未执行。怎么解决?

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="my_guid" Name="WixSingleSetupExample" Language="1055" Version="1.0.0.0" Manufacturer="Can Yucel" UpgradeCode="my_guid">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />

        <Feature Id="ProductFeature" Title="WixSingleSetupExample" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
            <ComponentRef Id="ApplicationShortcut" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="DesktopFolder" Name="Desktop" />
            <Directory Id="ProgramMenuFolder">
                <Directory Id="ApplicationProgramsFolder" Name="WixSingleSetup"/>
            </Directory>
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="WixSingleSetupExample" />
            </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="ProductTextFile">
              <File Source="blankText.txt" KeyPath="yes">
                  <Shortcut Id="desktopShortcut" Advertise="yes" Directory="DesktopFolder" Name="WixSingleSetup Help" WorkingDirectory="INSTALLFOLDER" Icon="icon1.txt" IconIndex="0">
                      <Icon Id="icon1.txt" SourceFile="blankText.txt"/>
                  </Shortcut>
              </File>      
          </Component>
        </ComponentGroup>
    </Fragment>

  <Fragment>
    <DirectoryRef Id="ApplicationProgramsFolder">
      <Component Id="ApplicationShortcut" Guid="my_guid">
        <Shortcut Id="ApplicationStartMenuShortcut"
                  Name="WixSingleSetup Help"
                  Description="Setup Example"
                  Target="blankText.txt"
                  WorkingDirectory="INSTALLFOLDER"
                  Icon="icon2.txt"
                  IconIndex="0">
          <Icon Id="icon2.txt" SourceFile="blankText.txt"/>
        </Shortcut>
        <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software/Microsoft/WixSingleSetup" Name="installed" Type="integer" Value="1" KeyPath="yes" />
      </Component>
    </DirectoryRef>
  </Fragment>
</Wix>

【问题讨论】:

  • 使用以下命令msiexec /i WixSingleSetupExample.msi /lvoicewarmupx log.txt 进行安装记录并查看日志文件 log.txt 是否提供任何有关组件未安装原因的指示。
  • 我按照你的要求做了,但输出日志文件有 1545 行长。日志文件中的启动路径是正确的,但我看不到任何错误指示。有什么建议去哪里看吗?或者如果你愿意,我可以在这里发送文件链接。
  • 下面接受的答案解决了这个问题。但是有了你的评论,我学会了如何登录,所以谢谢你。
  • 对于任何试图在 msi 日志中查找错误指示的人,请搜索 value 3

标签: wix windows-installer wix-extension


【解决方案1】:

我正在添加按预期工作的代码以供将来参考和问题的确切答案:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="guid_here" Name="WixSingleSetupExample" Language="1055"
           Version="1.0.0.0" Manufacturer="Can Yucel" UpgradeCode="guid_here">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="WixSingleSetupExample" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
      <ComponentRef Id="ProgramMenuDir"/>
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">

      <Directory Id="DesktopFolder" Name="Desktop" />

      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ApplicationProgramsFolder" Name="WixSingleSetup">
          <Component Id="ProgramMenuDir" Guid="guid_here">
            <RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\WixSetup"
                           Type="integer" Value="1" Name="installed" KeyPath="yes" />
          </Component>
        </Directory>
      </Directory>


      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="WixSingleSetupExample" />
      </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="ProductTextFile">
        <File Source="blankText.txt" KeyPath="yes">
          <Shortcut Id="desktopShortcut" Advertise="yes" Directory="DesktopFolder"
                    Name="WixSingleSetup Help" WorkingDirectory="INSTALLFOLDER"
                    Icon="icon1.txt" IconIndex="0">
            <Icon Id="icon1.txt" SourceFile="blankText.txt" />
          </Shortcut>
          <Shortcut Id="startMenuShotcut" Directory="ApplicationProgramsFolder"
                    Name="WiXSingleSetup Help" WorkingDirectory="INSTALLFOLDER"
                    Icon="icon2.txt" IconIndex="0" Advertise="yes">
            <Icon Id="icon2.txt" SourceFile="blankText.txt"/>
          </Shortcut>
        </File>      
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

【讨论】:

  • @nam 公平地说我不确定。
  • 错误 1 ​​ICE21:组件:“ProgramMenuDir”不属于任何功能
【解决方案2】:

我最近开始使用 Wix,但数周以来我一直被您描述的问题困扰。

我找到了另一种添加开始菜单快捷方式的方法,无需添加额外的组件(删除菜单文件夹),也无需在目标计算机注册表上创建热键。

这可以通过将 &lt;RemoveFolder ... /&gt; 定义移动到 &lt;Component Id="ProductTextFile" ...&gt; 元素中来完成。此后修改后的工作脚本:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="{GUID HERE}" Name="WixSingleSetupExample" Language="1055"
           Version="1.0.0.0" Manufacturer="Can Yucel" UpgradeCode="{GUID HERE}">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Icon Id="ICON1.ICO" SourceFile="icon1.ico" />
    <Icon Id="ICON2.ICO" SourceFile="icon2.ico" />

    <Feature Id="ProductFeature" Title="WixSingleSetupExample" Level="1">
      <ComponentRef Id="ProductTextFile" />
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="DesktopFolder" Name="Desktop" />

      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ApplicationProgramsFolder" Name="WixSingleSetup" />
      </Directory>

      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="WixSingleSetupExample" />
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
      <Component Id="ProductTextFile" Directory="INSTALLFOLDER" Guid="{GUID HERE}">
        <File Source="blankText.txt" KeyPath="yes">
          <Shortcut Id="desktopShortcut" Advertise="yes" Directory="DesktopFolder"
                    Name="WixSingleSetup Help" WorkingDirectory="INSTALLFOLDER"
                    Icon="ICON1.ICO" IconIndex="0" />

          <Shortcut Id="startMenuShotcut" Directory="ApplicationProgramsFolder"
                    Name="WiXSingleSetup Help" WorkingDirectory="INSTALLFOLDER"
                    Icon="ICON2.ICO" IconIndex="0" Advertise="yes" />
        </File>

        <RemoveFolder Id="ProgramMenuDir" Directory="ApplicationProgramsFolder" On="uninstall"/>
      </Component>
  </Fragment>
</Wix>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多