如何使用WiX 3.0部署注册表项和值?
时间:2020-03-06 14:39:16 来源:igfitidea点击:
如果我想创建注册表项
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp
与字符串值
EventMessageFile : C:\Path\To\File.dll
如何在WiX 3.0 WXS文件中定义它? XML应该看起来像什么的示例受到人们的赞赏。
解决方案
在DirectoryRef-> Directory ...下使用以下内容
<Component Id =" RegisterAddReferencesTab32" Guid =" D9D01248-8F19-45FC-B807-093CD6765A60"> <RegistryValue Action =" write" Id =" RegInstallDir32" Key =" HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Eventlog \ Application \ MyApp" Root =" HKLM" Type =" string" Value =" C:\ Path \ To \ File.dll" /> </ Component>
签出此页面。一个例子是:
<registry action="write" root"HKLM" key="SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp" type="string" value="EventMessageFile : C:\Path\To\File.dll" />
我去了:
<Component Id="EventLogRegKeys" Guid="{my guid}"> <RegistryKey Id="Registry_EventLog" Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp" Action="create"> <RegistryValue Id="Registry_EventLog_EventSourceDll" Action="write" KeyPath="yes" Name="EventMessageFile" Type="string" Value="C:\Path\To\File.dll" /> </RegistryKey> </Component>
最好使用文件引用语法来引用File.dll,以确保使用其安装到的实际路径。使用[#filekey]
,其中filekey
是描述文件的File
元素的Id
。
我们似乎想创建一个事件日志源。在这种情况下,我们应该查看util扩展中的<EventSource>元素。