WiX:从RegistrySearch设置安装目录会导致错误";无法访问网络位置“;

WiX:从RegistrySearch设置安装目录会导致错误";无法访问网络位置“;,wix,windows-installer,wix3.9,Wix,Windows Installer,Wix3.9,我正在制作一个基于WixUI_Advanced的安装程序。我使用的解决方案如下: 但是,我希望安装程序记住以前的安装目录。试图设置APPLICATIONFOLDER属性会导致错误“无法访问网络位置”,后跟目录名。只有在注册表中实际找到值时(升级程序时),才会发生这种情况 以下是相关代码: <Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" Manufacturer="OronD

我正在制作一个基于WixUI_Advanced的安装程序。我使用的解决方案如下:

但是,我希望安装程序记住以前的安装目录。试图设置APPLICATIONFOLDER属性会导致错误“无法访问网络位置”,后跟目录名。只有在注册表中实际找到值时(升级程序时),才会发生这种情况

以下是相关代码:

<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" Manufacturer="OronDF343" UpgradeCode="22187c5e-5fd6-4734-802e-236abd321433">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="$(var.ProductName)" />

<PropertyRef Id="NETFRAMEWORK45" />
<Condition Message="This application requires .NET Framework 4.5.1 or later. Please install .NET Framework version 4.5.1 or higher and then run this installer again.">
  <![CDATA[Installed OR (NETFRAMEWORK45 >= "#378758")]]>
</Condition>

    <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of $(var.GlobalProductName) is already installed." />

<!-- This is where the problem is. This is how it was implemented in the solution linked above, but I have tried it without the SetDirectory. -->
<Property Id="APPLICATIONFOLDER" Secure="yes">
  <RegistrySearch Id="RegistrySearch" Type="raw" Root="HKLM" Win64="$(var.Win64)" Key="Software\$(var.Company)\$(var.ProgID)" Name="InstallLocation" />
</Property>
<SetDirectory Id="APPLICATIONFOLDER" Value="[$(var.PlatformProgramFilesFolder)]$(var.GlobalProductName)">APPLICATIONFOLDER=""</SetDirectory>
<!---->

    <MediaTemplate EmbedCab="yes" />

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="DesktopFolder" Name="Desktop" />
  <Directory Id="$(var.PlatformProgramFilesFolder)">
    <Directory Id="APPLICATIONFOLDER" Name="$(var.GlobalProductName)">
      <Directory Id="skins" Name="skins"/>
    </Directory>
  </Directory>
  <Directory Id="ProgramMenuFolder">
    <Directory Id="ApplicationProgramsFolder" Name="$(var.GlobalProductName)"/>
  </Directory>
</Directory>

<Property Id="ApplicationFolderName" Value="$(var.GlobalProductName)" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<WixVariable Id="WixUISupportPerUser" Value="0" />
<WixVariable Id="WixUILicenseRtf" Value="gpl-3.0.rtf" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.GlobalProductName)" />
<Property Id="WixShellExecTarget" Value="[#$(var.Project.TargetFileName)]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />

    <Feature Id="ProductFeature" Title="$(var.ProductName) Core Files" Level="1" Absent="disallow">
  <ComponentRef Id="CreateDirectories" />
        <ComponentGroupRef Id="ProductComponents" />
  <ComponentGroupRef Id="RegistryStuff" />
    </Feature>
<UI>
  <UIRef Id="WixUI_Advanced" />
  <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<!--Hacks for WixUI_Advanced install folder-->
<CustomAction Id="OverwriteWixSetDefaultPerMachineFolder" Property="WixPerMachineFolder" Value="[APPLICATIONFOLDER]" Execute="immediate" />
<CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" />
<InstallUISequence>
  <Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
</InstallUISequence>
<InstallExecuteSequence>
  <Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
  <Custom Action="SetARPINSTALLLOCATION" After="InstallValidate"/>
</InstallExecuteSequence>
</Product>

= "#378758")]]>
APPLICATIONFOLDER=“”
WIXUI_EXITDIALOGOPTIONALCHECKBOX=1且未安装
编辑:我没有包含保存注册表值的代码,但它被保存为“'[APPLICATIONFOLDER]”,并删除了双引号,为新安装修复了它。
同样忘记了SetDirectory中的括号

我会创建一个详细日志,看看实际的属性值是什么。当结果看起来不像驱动器号路径时,您会收到该消息,因此它尝试将其作为网络路径,但失败。在错误消息中,它会说“无法访问网络位置”,然后是正确的路径。这不意味着属性设置为该值吗?我很好奇实际路径,以及您的设置是否为32位并试图对本机64位文件夹执行某些操作。我不知道该链接的哪一部分包含您正在使用的解决方案,但您将很难打破有关尝试从32位安装程序安装到64位位置的规则。只有64位MSI可以将64位组件安装到64位位置,如本机程序文件目录。我正在64位操作系统上安装一个64位软件包。看起来需要详细日志,请使用包含/l*vx的命令行安装,如果没有明确的原因,让我们来看看。