2016-05-31 82 views
1

我試圖做一個Windows 7的安裝程序,想在'所有程序'菜單和桌面上創建應用程序的快捷方式。我寫,但捷徑並未出現。這個代碼有什麼問題嗎?Wix安裝程序快捷方式啓動菜單沒有出現

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <?define POS_TargetDir=$(var.POS.TargetDir)?> 
    <Product Id="*" Name="PosSetupProject" Language="1033" Version="1.0.0.0" Manufacturer="Cumulus" UpgradeCode="*"> 
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 

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

    <Feature Id="ProductFeature" Title="PosSetupProject" Level="1"> 
     <ComponentGroupRef Id="ProductComponents" /> 
     <ComponentGroupRef Id="CReport_files" /> 
     <ComponentGroupRef Id="Resources_files" /> 
     <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="*"> 
      <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="PosSetupProject"> 
      <Directory Id="CReport" Name="CReport" /> 
      <Directory Id="Resources" Name="Resources" /> 
     </Directory> 
     </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="ProductComponent"> --> 
     <!-- TODO: Insert files, registry keys, and other resources here. --> 
     <!-- </Component> --> 

     <Component Id="POS.exe" Guid="*"> 
     <File Id="POS.exe" Name="POS.exe" Source="$(var.POS_TargetDir)POS.exe" /> 
     </Component> 
     <Component Id="POS.exe.config" Guid="*"> 
     <File Id="POS.exe.config" Name="POS.exe.config" Source="$(var.POS_TargetDir)POS.exe.config" /> 
     </Component> 
     <Component Id="poscon.pos" Guid="*"> 
     <File Id="poscon.pos" Name="poscon.pos" Source="$(var.POS_TargetDir)poscon.pos" /> 
     </Component> 

    </ComponentGroup> 
    </Fragment> 

    <Fragment> 
    <ComponentGroup Id="CReport_files" Directory="CReport"> 

    </ComponentGroup> 
    </Fragment> 
    <Fragment> 
    <ComponentGroup Id="Resources_files" Directory="Resources"> 

    </ComponentGroup> 
    </Fragment> 
</Wix> 

回答

1

如果我不缺什麼,好了,Shortcut-element完全丟失。我想你想創建一個快捷方式到POS.exe。在這種情況下,您的POS.exe -component更改爲以下:

<Component Id="POS.exe" Guid="*"> 
    <File Id="POS.exe" Name="POS.exe" Source="$(var.POS_TargetDir)POS.exe" /> 
    <Shortcut Id="MyShortcut" Name="My shortcut" Target="[POS.exe]" /> 
    </Component> 

這應該使用POS.exe -component爲目標,安裝快捷方式進入程序菜單爲所有用戶(如果屬性ALLUSERS設置爲1)。
另請參閱how-to on the WiX-site關於創建快捷方式。

相關問題