自定义操作添加的临时行将被WriteRegistryValues忽略 [英] Temporary rows added by custom-action are ignored by WriteRegistryValues

查看:62
本文介绍了自定义操作添加的临时行将被WriteRegistryValues忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写WIX脚本.

I'm writing a WIX script.

我有一个自定义操作,可将行动态添加到注册表表中:

I have a custom-action that adds rows dynamically to the Registry table:

function AddRegistry() 
{
    var registryView = Session.Database.OpenView("SELECT * FROM Registry");
    registryView.Execute();

    var record = Session.Installer.CreateRecord(6);
    record.StringData(1) = "Unique123456";
    record.IntegerData(2) = 2;
    record.StringData(3) = "Software";
    record.StringData(4) = "my_registry_string";
    record.StringData(5) = "value";
    record.StringData(6) = "MyComponent";

    registryView.Modify(7, record); //InsertTemporary
    registryView.Close();

    return 1; //Ok
}

该自定义操作计划在"WriteRegistryValues"操作之前以立即"运行:

The custom-action is scheduled to run as "immediate" and before the "WriteRegistryValues" action:

<CustomAction Id="AddRegistry" BinaryKey="CustomActionJS" 
              JScriptCall="AddRegistry" 
              Execute="immediate" Impersonate="no" />

<InstallExecuteSequence>
    <Custom Action="AddRegistry" Before="WriteRegistryValues" />
    <Custom Action="CheckRegistry" After="WriteRegistryValues" />
...
</InstallExecuteSequence>

我添加了第二个自定义操作,该操作枚举了注册表表,并显示了所有刚刚找到的条目(固定的和临时的).

I've added a 2nd custom-action that enumerates the Registry table, and shows all the entries just find (fixed and temporary).

但是,当执行WriteRegistryValues时(据我所知,它被推迟了),它仅写入固定的条目.我的动态条目将被忽略,并且不会添加到注册表中.

However, when the WriteRegistryValues is being executed (it is deferred, as far as I understand), it only writes the fixed entries. My dynamic entries are ignored, and not added to the registry.

在相同注册表路径下的固定注册表项可以正常工作:

A fixed Registry entry to the same registry path works fine:

<Component Id="MyComponent">
    <RegistryValue Id="Unique11111" Root="HKLM" Key="Software" 
                   Name="my_fixed_value" Value="my_value" 
                   Action="write" Type="string"/>
</Component>

知道我在做什么错吗?

推荐答案

确定!

我认为这是我们的工作-向注册表表中添加行的CA必须在 InstallValidate 之前运行(在 WriteRegistryValues 之前运行)

I figured it our - the CA that adds rows to the Registry table must run before InstallValidate (which runs before WriteRegistryValues)

如此改变

<Custom Action="AddRegistry" Before="WriteRegistryValues" />

<Custom Action="AddRegistry" Before="InstallValidate" />

解决了问题

这篇关于自定义操作添加的临时行将被WriteRegistryValues忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆