Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wix安装程序在更新时使用默认应用程序路径,而不是按预期从注册表中使用_Wix_Windows Installer - Fatal编程技术网

Wix安装程序在更新时使用默认应用程序路径,而不是按预期从注册表中使用

Wix安装程序在更新时使用默认应用程序路径,而不是按预期从注册表中使用,wix,windows-installer,Wix,Windows Installer,我们正在使用Wix工具集V3.11构建我们的设置 由于以下声明,我们的默认安装路径是C:/ProgramFiles(x86)/Acme/AppName <Property Id="ApplicationFolderName" Value="$(var.Manufacturer)\$(var.AppFolderName)" /> <Property Id="WixAppFolder" Value="WixPerMachineFolder" /> 通过Regedit.ex

我们正在使用Wix工具集V3.11构建我们的设置

由于以下声明,我们的默认安装路径是
C:/ProgramFiles(x86)/Acme/AppName

<Property Id="ApplicationFolderName" Value="$(var.Manufacturer)\$(var.AppFolderName)"  />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
通过Regedit.exe,我可以看到注册表中的路径
C:/ProgramFiles(x86)/Acme/FooBar
。好的

问题:但现在,当我运行一个更新的新安装程序时,所有文件都已从自定义文件夹
C:/Program Files(x86)/Acme/FooBar
移动到默认文件夹
C:/Program Files(x86)/Acme/AppName

当我执行更新并单击“高级”按钮时,默认路径
C:/ProgramFiles(x86)/Acme/AppName
已预先分配:

我使用以下标记查询注册表外的路径:

<Property Id="APPLICATIONFOLDER">
    <RegistrySearch Id='InstallationRegistrySearch' Type='raw' Root='HKLM' Key='Software\$(var.Manufacturer)\$(var.AppName)' Name='InstallDir' />
</Property>

以下是相关的标记:

<Fragment>
    <ComponentGroup Id="RootComponents" Directory="APPLICATIONFOLDER">
      <Component Id="RootComponent" Guid="xxxxxxxxx" Win64='yes'>   
        <RegistryKey
          Key="Software\$(var.Manufacturer)\$(var.AppName)"
          Root="HKLM">
          <RegistryValue Id="InstallationRegistry"
                         Type="string"
                         Name="InstallDir"
                         Value="[APPLICATIONFOLDER]" />
        </RegistryKey>

      </Component>      
    </ComponentGroup>

    [...]


<Product ...>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="PROGRAMFILESPATH" Name="$(var.ProgramFilesPath)">
        <Directory Id="ManufacturerFolder" Name="$(var.Manufacturer)">
          <Directory Id="APPLICATIONFOLDER" Name="$(var.AppFolderName)" >

            <!-- here are the application files (e.g. Appname.exe)-->
            [...]

          </Directory>
        </Directory>
      </Directory>      
    </Directory>


    [...]

    <Property Id="ApplicationFolderName" Value="$(var.Manufacturer)\$(var.AppFolderName)"  />
    <Property Id="WixAppFolder" Value="WixPerMachineFolder" />

    <Property Id="APPLICATIONFOLDER">
      <RegistrySearch Id='InstallationRegistrySearch' Type='raw' Root='HKLM' Key='Software\$(var.Manufacturer)\$(var.AppName)' Name='InstallDir' />
    </Property>

    <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
    <Property Id="ALLUSERS" Value="1"/>

    [...]

    <UI>
      [...]
      <UIRef Id="WixUI_Advanced"/>
    </UI>
</Product>

[...]
[...]
[...]
[...]
[...]
我们做错了什么?

记住属性:属性值不是由MSI自动神奇地持久化的,因此需要诸如“”之类的模式

比特数:看起来您正在从注册表中读取数据,但是否存在“比特数问题”?换句话说,您是从注册表的x64部分读取的,而不是从x86部分读取的?(反之亦然)

  • HKEY\U LOCAL\U MACHINE\SOFTWARE\Manufacturer\Acme\Program

  • HKEY\U LOCAL\U MACHINE\SOFTWARE\Wow6432Node\Manufacturer\Acme\Program

<Fragment>
    <ComponentGroup Id="RootComponents" Directory="APPLICATIONFOLDER">
      <Component Id="RootComponent" Guid="xxxxxxxxx" Win64='yes'>   
        <RegistryKey
          Key="Software\$(var.Manufacturer)\$(var.AppName)"
          Root="HKLM">
          <RegistryValue Id="InstallationRegistry"
                         Type="string"
                         Name="InstallDir"
                         Value="[APPLICATIONFOLDER]" />
        </RegistryKey>

      </Component>      
    </ComponentGroup>

    [...]


<Product ...>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="PROGRAMFILESPATH" Name="$(var.ProgramFilesPath)">
        <Directory Id="ManufacturerFolder" Name="$(var.Manufacturer)">
          <Directory Id="APPLICATIONFOLDER" Name="$(var.AppFolderName)" >

            <!-- here are the application files (e.g. Appname.exe)-->
            [...]

          </Directory>
        </Directory>
      </Directory>      
    </Directory>


    [...]

    <Property Id="ApplicationFolderName" Value="$(var.Manufacturer)\$(var.AppFolderName)"  />
    <Property Id="WixAppFolder" Value="WixPerMachineFolder" />

    <Property Id="APPLICATIONFOLDER">
      <RegistrySearch Id='InstallationRegistrySearch' Type='raw' Root='HKLM' Key='Software\$(var.Manufacturer)\$(var.AppName)' Name='InstallDir' />
    </Property>

    <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
    <Property Id="ALLUSERS" Value="1"/>

    [...]

    <UI>
      [...]
      <UIRef Id="WixUI_Advanced"/>
    </UI>
</Product>