开发者

wix - fill edit-control with value from registry

Installer is writting SQL Server's name to registry during installing my service. And I created a dialog window with edit control where user will type the servername . Now I want to fill this control with value from registry in ChangeMode. And if this registry key is empty to fill with some default name. How is possible to r开发者_如何转开发esolve it? I tried to put RegistrySearch node into Control node. But it seems to me it's not working.. Any help is appreciated

P.S. Looked some information here: link1. And tried code like:

<Property Id="SERVCONNSTR" Value=".\SQLEXPRESS">            
        </Property>
<Property Id="CONNSEARCH">
<RegistrySearch Id="servconstr" Root="HKLM"
    Key="Software\$(var.Manufacturer)\SERVICE" Name="SQL Server" Type="raw"></RegistrySearch>
</Property>
<SetProperty Id="SERVCONNSTR" Value="CONNSEARCH"
     After="AppSearch"><![CDATA[CONNSEARCH AND (!FEATURE1=3 OR !FEATURE2=3 OR !FEATURE3=3)]]></SetProperty>

But I'm still getting .\SQLEXPRESS in edit-control during modifying.

What i'm doing wrong?


Put RegistrySearch into a Property, and tie that property to the Control.


<Property Id="SERVCONNSTR" Value=".\SQLEXPRESS">            
        </Property>
<Property Id="CONNSEARCH">
<RegistrySearch Id="servconstr" Root="HKLM"
    Key="Software\$(var.Manufacturer)\SERVICE" Name="SQL Server" Type="raw"></RegistrySearch>
</Property>
<SetProperty Id="SERVCONNSTR" Value="[CONNSEARCH]"
     After="AppSearch">CONNSEARCH</SetProperty>


I don't know why you are using two properties, If you set your property CONNSEARCH with the registrySearch, it'll check the registry and assign it the value found there, if one is present. This happens in the AppSearch phase well before most UI's take place, where your edit box would be. So you shouldn't need to use SetProperty either.

Did you want to fill the registry key with a default value, or your property with a default value?

For the property just fill the Value attribute of the property element that is using a registry search. It'll default to that if nothing is found in registry, as I said above.

It would look like this;

<

<Property Id="CONNSEARCH" Value="DefaultValue">
<RegistrySearch Id="servconstr" Root="HKLM"
    Key="Software\$(var.Manufacturer)\SERVICE" Name="SQL Server" Type="raw"></RegistrySearch>
</Property>

After Appsearch your property would be set, and if your control is tied to that property it'll be filled with that value. This will also set your default property value to "DefaultValue" If nothing is in the registry.

To create a default value for the key in the registry, I guess just put a registryKey/RegistryValue element in a component that will always be installed in this scenario, and set that key to your default value if you don't set it anywhere else.

Best

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜