更新时间:2023-01-31 12:53:19
我自己也遇到了麻烦.这是一个有效的项目模板:
I had trouble with this myself. Here is a project template that works:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="243604BF-62BC-4B9B-BFA7-8BD43DE096B9" Name="JTsApp" Language="1033" Version="1.4.0.0" Manufacturer="JT Pty Ltd" UpgradeCode="CEFF1611-50E1-4DC9-BC60-548A76312AA5">
<Package Description="JTsApp Installer" Comments="JTsApp" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Upgrade Id="{CEFF1611-50E1-4DC9-BC60-548A76312AA5}">
<UpgradeVersion Minimum="1.0.4" IncludeMinimum="yes" Maximum="1.4.0" IncludeMaximum="yes" Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade>
<Icon Id="favicon.ico" SourceFile="JTsApp.ico"/>
<Property Id="ARPPRODUCTICON" Value="favicon.ico" />
<!--Ref: http://***.com/questions/2058230/wix-create-non-advertised-shortcut-for-all-users-per-machine
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />-->
<Feature Id="ProductFeature" Title="JTsApp" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="ProgramMenuDir"/>
</Feature>
<Media Id="1" Cabinet="JTsApp.cab" EmbedCab="yes" />
<!--<PropertyRef Id="NETFRAMEWORK40FULL" />
<Condition Message="This application requires .NET Framework 4.0.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>-->
<UIRef Id="MyWixUI_Minimal" />
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize"/>
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="DesktopFolder" SourceName="Desktop" />
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ApplicationProgramsFolder" Name="JTsApp">
<Component Id="ProgramMenuDir" Guid="F8F34900-78DC-43FD-8C24-FC8A2401981D">
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
<RegistryValue Root="HKMU" Key="Software[Manufacturer]JTsApp" Type="integer" Value="1" Name="installed" KeyPath="yes" />
</Component>
</Directory>
</Directory>
<Directory Id="ProgramFilesFolder">
<Directory Id="ManufacturerFolder" Name="JTs Pty Ltd">
<Directory Id="INSTALLFOLDER" Name="JTsApp">
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!--Core Application-->
<Component Id="TouchTypingWizard_Component">
<File Id="TouchTypingWizard.exe" KeyPath="yes" Name="TouchTypingWizard.exe" Source="C:1AWiXsInstallerTemplateSetupProject1TouchTypingWizardinDebugTouchTypingWizard.exe" />
<Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="JTsApp" WorkingDirectory="INSTALLDIR" Advertise="yes" Icon="favicon.ico" IconIndex="0" />
<Shortcut Id="ExeShortcut" Directory="ApplicationProgramsFolder" Name="JTsApp" WorkingDirectory="INSTALLDIR" Advertise="yes" Icon="favicon.ico" IconIndex="0" />
</Component>
<Component Id="JTsApp_DefaultIcon_RegKey">
<RegistryValue Id="JTsApp_DefaultIcon_RegKey" Root="HKCR" Key="JTsAppDefaultIcon" Value="" Type="string" KeyPath="yes" />
</Component>
<Component Id="JTsApp_DefaultIcon_exe_RegKey_Component">
<RegistryValue Id="JTsApp_DefaultIcon_exe_RegKey" Root="HKCR" Key="JTsAppDefaultIcon" Name="Default" Value="TouchTypingWizard.exe,1" Type="string" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
您可以看到我尝试了很多东西,但我没有花时间缩小范围.我相信这几行是关键:
You can see I tried a lot of things and I haven't taken the time to narrow it down. I believe these lines are the key:
<Shortcut Id="DesktopShortcut" Directory="DesktopFolder"
Name="JTsApp" WorkingDirectory="INSTALLDIR" Advertise="yes"
Icon="favicon.ico" IconIndex="0" />
<Shortcut Id="ExeShortcut" Directory="ApplicationProgramsFolder" Name="JTsApp" WorkingDirectory="INSTALLDIR" Advertise="yes"
Icon="favicon.ico" IconIndex="0" />
虽然,我不排除以下几行:
Although, I haven't ruled out these lines:
<Component Id="JTsApp_DefaultIcon_exe_RegKey_Component">
<RegistryValue Id="JTsApp_DefaultIcon_exe_RegKey" Root="HKCR" Key="JTsAppDefaultIcon" Name="Default"
Value="TouchTypingWizard.exe,1" Type="string" KeyPath="yes" />
</Component>
不管怎样,这就是它有效的证明:
Anyway, here is proof it works:
这里是安装项目目录中的文件:
Here are the files in the setup project directory:
解决方案如下所示:
^^ 注意:我引用了 C:Program FilesWiX Toolset v3.8inWixUIExtension.dll 并包含了 MyWixUI_Minimal.wxs 文件.
^^ Note: I reference the C:Program FilesWiX Toolset v3.8inWixUIExtension.dll and I include the MyWixUI_Minimal.wxs file.
这里是安装项目供您下载并确认它可以工作:
Here is the Setup Project for you to download and confirm it works: