Installation WiX安装程序创建注册表项不需要';也使用CustomActions时不起作用

Installation WiX安装程序创建注册表项不需要';也使用CustomActions时不起作用,installation,wix,windows-installer,registry,Installation,Wix,Windows Installer,Registry,我在理解WiX设置的操作顺序时遇到问题。 尝试创建注册表项以将菜单项添加到Windows资源管理器上下文菜单时,同时 使用CustomActions,不会添加注册表项。 但是,如果我只尝试注册密钥,它就会工作(任何CustomAction代码都会被注释掉) <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="d

我在理解WiX设置的操作顺序时遇到问题。
尝试创建注册表项以将菜单项添加到Windows资源管理器上下文菜单时,同时 使用CustomActions,不会添加注册表项。 但是,如果我只尝试注册密钥,它就会工作(任何CustomAction代码都会被注释掉)

<CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
<CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
              Value="app=AB;key=10000P1000" />
  • 在我的Product.wxs中,我使用

  • <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    
  • 在我的
    已引用

  • <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    
  • 这是创建注册表项的代码

        <Fragment>
          <Directory Id="TARGETDIR" Name="SourceDir">
            <Component Id="RegistryEntries" Guid="*">
              <RegistryKey Root="HKCR"
                            Key="Excel.CSV\shell\Use MyConverter\command"
                            ForceCreateOnInstall="yes"
                            ForceDeleteOnUninstall="yes">
                <RegistryValue Type="string" Value="[INSTALLLOCATION]$(var.SolutionName).exe %1"
                                KeyPath="yes"/>
              </RegistryKey>
            </Component>
            <Directory Id="ProgramFilesFolder">
              <Directory Id="HSZLG" Name="MyConverter">
                <Directory Id="INSTALLLOCATION" Name="$(var.SolutionName)" />
              </Directory>
            </Directory>
            <!--<Directory Id="ProgramMenuFolder">
            <Directory Id="Shortcuts" Name="MyConverter" />
            </Directory>-->
        </Directory>
        </Fragment>
    
    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    
    
    
  • 现在,我还使用以下自定义操作:

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    
    
    
    并在
    中这样称呼他们:

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    
    <InstallExecuteSequence>
      <Custom Action="PropertiesForRegisterImportFormat" Before="RegisterImportFormat" />
      <Custom Action="RegisterImportFormat" Before="InstallFinalize">(NOT Installed) OR REINSTALL</Custom>
    
      <Custom Action="PropertiesForUnregisterImportFormat" Before="UnregisterImportFormat" />
      <Custom Action="UnregisterImportFormat" Before="InstallFinalize">REMOVE</Custom>
    </InstallExecuteSequence>
    
    
    (未安装)或重新安装
    去除
    

  • 如果有人能指出我做错了什么,我将不胜感激。

    在没有模拟和HKCR键的情况下运行(延迟)自定义操作会有困难,因为HKCR不是实际的注册表位置-它是交互式用户和HKEY_LOCAL_MACHINE\Software\Class的合并。这一点非常详细:

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    
    自定义操作代码与系统帐户(延迟,无模拟)一起运行,这增加了关于您正在创建哪个注册表项的更多混淆。正如MSDN注释所述:

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    
    要更改交互用户的设置,请将更改存储在HKEY\U CURRENT\U user\Software\Classes而不是HKEY\U Classes\U ROOT下

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    

    我假设您的代码正在尝试使用HKCR。Windows Installer是编写这些注册表项的首选,因为“它只是工作”。使用写入HKCR的系统帐户运行的代码是不可靠的,因此,如果您确实必须使用(而且不应该)代码,请尝试使用HKEY\U LOCAL\U MACHINE\Software\Classes

    在没有模拟和HKCR键的情况下运行(延迟)自定义操作会有困难,因为HKCR不是实际的注册表位置-它是交互式用户和HKEY_LOCAL_MACHINE\Software\Classes的合并。这一点非常详细:

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    
    自定义操作代码与系统帐户(延迟,无模拟)一起运行,这增加了关于您正在创建哪个注册表项的更多混淆。正如MSDN注释所述:

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    
    要更改交互用户的设置,请将更改存储在HKEY\U CURRENT\U user\Software\Classes而不是HKEY\U Classes\U ROOT下

    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />
    

    我假设您的代码正在尝试使用HKCR。Windows Installer是编写这些注册表项的首选,因为“它只是工作”。使用写入HKCR的系统帐户运行的代码是不可靠的,因此,如果您确实必须使用(而且不应该)代码,请尝试使用HKEY\U LOCAL\U MACHINE\Software\Classes

    这是我的必读书目:这是我的必读书目:
    <CustomAction Id="UnregisterImportFormat" BinaryKey="WixCustomAction" DllEntry="UnregisterImportDefinition" Execute="deferred" Impersonate="no" Return="check"  />
    <CustomAction Id="PropertiesForUnregisterImportFormat" Property="UnregisterImportFormat" Return="check" 
                  Value="app=AB;key=10000P1000" />