我基于这个示例创建了我的事件源。我的事件源如下所示:
[EventSource(Name = "Samples-EventSourceDemos-EventLog")]
public sealed class MinimalEventSource : EventSource
{
public static MinimalEventSource Log = new MinimalEventSource();
[Event(1, Message = "{0} -> {1}", Channel = EventChannel.Admin)]
public void Load(long baseAddress, string imageName)
{
WriteEvent(1, baseAddress, imageName);
}
}该示例使用代码模拟安装/卸载过程。从其他一些这样的问题中,我看到了使用事件消息文件安装事件源的另一个示例。
但是缺少一些好的例子,如何安装/注册清单定义的EventSource。我正在调查如何使用CustomAction来做这样的事情:
wevtutil.exe im <EtwManifestManFile> /rf:"EtwManifestDllFile" /mf:"EtwManifestDllFile"
但不知道你有什么建议吗?
发布于 2014-04-03 00:02:27
经过搜索就知道了。在WixUtilExtension中,有内置支持。在引用它并添加命名空间之后,它非常容易。
下面是Product.wxs中的更改:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
...
<Component Id="etwManifest.dll">
<File Id="etwManifest.dll" KeyPath="yes"
Source="$(var.SampleClassLibrary.TargetDir)\SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll" />
</Component>
<Component Id="etwManifest.man">
<File Id="etwManifest.man" KeyPath="yes"
Source="$(var.SampleClassLibrary.TargetDir)\SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.man">
<util:EventManifest MessageFile="[etwManifest.dll]" ResourceFile="[etwManifest.dll]"></util:EventManifest>
</File>
</Component>
</Wix>我唯一需要做的就是减少组件Id和文件Id的长度(用于匹配文件名),以避免以下错误:错误25540。配置XML文件时发生了故障。
发布于 2016-09-02 12:09:02
对我来说,解决方案是向两个文件,即.dll和.man添加权限。(https://stackoverflow.com/a/32727624/5500092)
<util:PermissionEx User="Everyone" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes" />我还必须添加完整的路径来正确注册清单文件。当我没有这样做时,清单文件仍然引用我的visual studio解决方案的bin/ solution文件夹。
<util:EventManifest MessageFile="[INSTALLFOLDER]SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll" ResourceFile="[INSTALLFOLDER]SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll"/>代码:
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="etwManifest.dll" Guid="PUT-GUID-HERE">
<File Id="etwManifest.dll" KeyPath="yes" Source="$(var.SampleClassLibrary.TargetDir)\SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll" >
<util:PermissionEx User="Everyone" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes" />
<util:PermissionEx User="Administrators" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes"/>
</File>
</Component>
<Component Id="etwManifest.man" Guid="PUT-GUID-HERE">
<File Id="etwManifest.man" KeyPath="yes" Source="$(var.SampleClassLibrary.TargetDir)\SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.man" >
<util:PermissionEx User="Everyone" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes"/>
<util:PermissionEx User="Administrators" ReadPermission="yes" ReadAttributes="yes" ReadExtendedAttributes="yes"/>
<util:EventManifest MessageFile="[INSTALLFOLDER]SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll" ResourceFile="[INSTALLFOLDER]SampleClassLibrary.Samples-EventSourceDemos-EventLog.etwManifest.dll"/>
</File>
</Component>
</DirectoryRef>使用WiX工具集v3.10
(如果我的英语不好,请纠正我)
https://stackoverflow.com/questions/22822183
复制相似问题