如何使用WiX创建.NET事件日志源
这是和的有意半复制品 我的第一个问题是,它真的必须如此复杂吗?是否有一些方法可以简单地向WiX指定“我的程序是一个.Net程序,它需要写入事件日志-请进行必要的设置” 好的,假设这是不可能的,我希望收到任何关于必要WiX语句的建议,以使其工作,而不管安装了哪个版本的.Net Framework,也不管它是32位还是64位系统。毕竟,我的大多数.Net程序都可以在.NET2.0或更高版本上运行,并且可以在32位或64位上运行,所以这并不重要如何使用WiX创建.NET事件日志源,wix,event-log,wix3.5,eventlog-source,Wix,Event Log,Wix3.5,Eventlog Source,这是和的有意半复制品 我的第一个问题是,它真的必须如此复杂吗?是否有一些方法可以简单地向WiX指定“我的程序是一个.Net程序,它需要写入事件日志-请进行必要的设置” 好的,假设这是不可能的,我希望收到任何关于必要WiX语句的建议,以使其工作,而不管安装了哪个版本的.Net Framework,也不管它是32位还是64位系统。毕竟,我的大多数.Net程序都可以在.NET2.0或更高版本上运行,并且可以在32位或64位上运行,所以这并不重要 最后一个问题:有没有办法让它成为未来的证明?如果我今天生
最后一个问题:有没有办法让它成为未来的证明?如果我今天生成的MSI文件在五年后仍能正常工作,那就太好了,即使.Net CLR 2.0和4.0都已经在Windows 11中被扔进了垃圾箱,或者不管它当时叫什么 按要求。使用UtilExtension在.NET 4完整和.NET 4客户端配置文件上工作的解决方案: 1) 添加以下PropertyRef:
<PropertyRef Id="NETFRAMEWORK40FULLINSTALLROOTDIR"/>
<PropertyRef Id="NETFRAMEWORK40FULLINSTALLROOTDIR64"/>
<PropertyRef Id="NETFRAMEWORK40CLIENTINSTALLROOTDIR"/>
<PropertyRef Id="NETFRAMEWORK40CLIENTINSTALLROOTDIR64"/>
2) 32位部分:
<!-- Event Source creation for 32bit OS with .NET 4 Full-->
<Component Id="CreateEventSource32BitFullNet4" Guid="your-guid-here">
<Condition><![CDATA[NETFRAMEWORK40FULLINSTALLROOTDIR AND NOT VersionNT64]]></Condition>
<CreateFolder/>
<!-- Create an Event Source -->
<Util:EventSource
xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"
Name="YOUR APP NAME"
Log="Application"
EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR]EventLogMessages.dll"/>
</Component>
<!-- Event Source creation for 32bit OS with .NET 4 Client Profile-->
<Component Id="CreateEventSource32BitClientNet4" Guid="your-guid-here">
<Condition><![CDATA[NETFRAMEWORK40CLIENTINSTALLROOTDIR AND NOT VersionNT64]]></Condition>
<CreateFolder/>
<!-- Create an Event Source -->
<Util:EventSource
xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"
Name="YOUR APP NAME"
Log="Application"
EventMessageFile="[NETFRAMEWORK40CLIENTINSTALLROOTDIR]EventLogMessages.dll"/>
</Component>
<!-- Event Source creation for 64bit OS with .NET 4 Full -->
<Component Id="CreateEventSource64BitFullNet4" Guid="your-guid-here">
<Condition><![CDATA[NETFRAMEWORK40FULLINSTALLROOTDIR64 AND VersionNT64]]></Condition>
<CreateFolder/>
<!-- Create an Event Source -->
<Util:EventSource
xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"
Name="YOUR APP NAME"
Log="Application"
EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR64]EventLogMessages.dll"/>
</Component>
<!-- Event Source creation for 64bit OS with .NET 4 Client Profile -->
<Component Id="CreateEventSource64BitClientNet4" Guid="your-guid-here">
<Condition><![CDATA[NETFRAMEWORK40CLIENTINSTALLROOTDIR64 AND VersionNT64]]></Condition>
<CreateFolder/>
<!-- Create an Event Source -->
<Util:EventSource
xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"
Name="YOUR APP NAME"
Log="Application"
EventMessageFile="[NETFRAMEWORK40CLIENTINSTALLROOTDIR64]EventLogMessages.dll"/>
</Component>
3) 64位部分:
<!-- Event Source creation for 32bit OS with .NET 4 Full-->
<Component Id="CreateEventSource32BitFullNet4" Guid="your-guid-here">
<Condition><![CDATA[NETFRAMEWORK40FULLINSTALLROOTDIR AND NOT VersionNT64]]></Condition>
<CreateFolder/>
<!-- Create an Event Source -->
<Util:EventSource
xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"
Name="YOUR APP NAME"
Log="Application"
EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR]EventLogMessages.dll"/>
</Component>
<!-- Event Source creation for 32bit OS with .NET 4 Client Profile-->
<Component Id="CreateEventSource32BitClientNet4" Guid="your-guid-here">
<Condition><![CDATA[NETFRAMEWORK40CLIENTINSTALLROOTDIR AND NOT VersionNT64]]></Condition>
<CreateFolder/>
<!-- Create an Event Source -->
<Util:EventSource
xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"
Name="YOUR APP NAME"
Log="Application"
EventMessageFile="[NETFRAMEWORK40CLIENTINSTALLROOTDIR]EventLogMessages.dll"/>
</Component>
<!-- Event Source creation for 64bit OS with .NET 4 Full -->
<Component Id="CreateEventSource64BitFullNet4" Guid="your-guid-here">
<Condition><![CDATA[NETFRAMEWORK40FULLINSTALLROOTDIR64 AND VersionNT64]]></Condition>
<CreateFolder/>
<!-- Create an Event Source -->
<Util:EventSource
xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"
Name="YOUR APP NAME"
Log="Application"
EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR64]EventLogMessages.dll"/>
</Component>
<!-- Event Source creation for 64bit OS with .NET 4 Client Profile -->
<Component Id="CreateEventSource64BitClientNet4" Guid="your-guid-here">
<Condition><![CDATA[NETFRAMEWORK40CLIENTINSTALLROOTDIR64 AND VersionNT64]]></Condition>
<CreateFolder/>
<!-- Create an Event Source -->
<Util:EventSource
xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"
Name="YOUR APP NAME"
Log="Application"
EventMessageFile="[NETFRAMEWORK40CLIENTINSTALLROOTDIR64]EventLogMessages.dll"/>
</Component>
我同意你的看法。做这个很复杂。我有一个更简单的设置(仅针对.NET 4),但它仍然很复杂:32位/64位OS+.NET 4客户端配置文件/.NET 4完整。我有一个可行的解决方案-但它不是未来的证明-代码不是很可读。莫顿,谢谢你的评论。如果您发布您当前的解决方案作为我问题的答案,我将不胜感激。Morten,这是否意味着安装程序生成的日志将记录在我们提到的任何源下,而不是默认情况下它记录的MSInstaller源下?否,randomuser25995183,正在为已安装的应用程序创建此日志源,以便将其用于系统日志中的日志记录。