我正在尝试使用 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>