0

我有一个简单的 C# 应用程序,并且正在尝试使用 Wix(第一次)不仅安装文件,还添加指向 All Programs 文件夹的链接。msi 创建所有正确的目录,很好地安装应用程序,甚至添加看起来不错的链接到所有程序(我的公司文件夹和文件夹下的应用程序链接)。

但是,转到所有程序,展开我公司文件夹的链接,然后单击应用程序的链接,只会打开一个新的 Windows 资源管理器窗口,其中显示“C:\”主目录的内容。

我究竟做错了什么?我查看了 Wix 帮助站点上的页面和此处的其他帖子(多次),没有看到我错过了什么。

顺便说一句 - 我正在使用所有“绑定”。和“变种”。参考,希望一旦我完成所有工作,我可以将其用作未来应用程序的模板,而无需更改许多文字。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="{CE767FBA-D925-4227-887B-34B95CDE390F}" Name="Application Settings Editor" Language="1033" Version="1.0.0.0" 
      Manufacturer="My Company Name" UpgradeCode="{8DC42ABA-F73D-4113-9BFD-0766B4124FD1}">
    <Package InstallerVersion="300" Compressed="yes" InstallScope="perMachine"/>
    <Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="MANUFACTURERFOLDER" Name="!(bind.property.Manufacturer)" >
          <Directory Id="APPLICATIONROOTDIRECTORY" Name="!(bind.property.ProductName)"/>
        </Directory>
      </Directory>
      <!-- Step 1: Define the directory structure -->
      <Directory Id="ProgramMenuFolder">
        <Directory Id="CompanyFolder" Name="!(bind.property.Manufacturer)">
          <Directory Id="AppFolder" Name="!(bind.property.ProductName)"/>
        </Directory>
      </Directory>
    </Directory>

    <DirectoryRef Id="APPLICATIONROOTDIRECTORY">
      <Component Id="$(var.Application_Settings_Editor.TargetFileName)" Guid="{8DC42ABA-F73D-4113-9BFD-0766B4124FD1}">
        <File Id="$(var.Application_Settings_Editor.TargetFileName)" Source="..\Application Settings Editor\bin\Debug\Application_Settings_Editor.exe" KeyPath="yes" Checksum="yes"/>
      </Component>
    </DirectoryRef>

    <!-- Step 2: Add the shortcut to your installer package -->
    <DirectoryRef Id="AppFolder">
      <Component Id="AppStartMenu" Guid="{2781BD2D-5F30-4D2A-BBAE-D2B64EB30A75}">
        <Shortcut Id="AppStartMenuShortcut"
           Name="!(bind.property.ProductName)"
           Description="General Application Settings Editor"
           Target="[INSTALLFOLDER]\[$(var.Application_Settings_Editor.TargetFileName)]"
           WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
        <RemoveFolder Id="RemoveCompanyFolder" Directory="CompanyFolder" On="uninstall"/>
        <RemoveFolder Id="RemoveAppFolder" Directory="AppFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\!(bind.property.Manufacturer)\!(bind.property.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </DirectoryRef>

    <Feature Id="MainApplication" Title="Main Application" Level="1">
      <ComponentRef Id="$(var.Application_Settings_Editor.TargetFileName)" />
      <ComponentRef Id="AppStartMenu" />
    </Feature>
  </Product>
</Wix>
4

1 回答 1

1

您的快捷方式的目标看起来不正确,因为您没有 ID 为“INSTALLFOLDER”的目录。尝试 [APPLICATIONROOTDIRECTORY] 而不是 [INSTALLFOLDER]。

<Shortcut Id="AppStartMenuShortcut"
       Name="!(bind.property.ProductName)"
       Description="General Application Settings Editor"
       Target="[APPLICATIONROOTDIRECTORY]\$(var.Application_Settings_Editor.TargetFileName)"
       WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
于 2017-11-07T21:58:31.667 回答