WIX:使用.NET消息文件创建EventSource

编程入门 行业动态 更新时间:2024-10-27 07:31:28
本文介绍了WIX:使用.NET消息文件创建EventSource的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用WIX为我的应用程序创建安装程序.到目前为止一切正常.但是,我正在尝试在安装过程中创建一个新的事件源,但无法按预期工作.

I'm creating an installer for my application using WIX. Everything works fine so far. However, I'm trying to create a new event source during installation and that doesn't work as expected.

我已阅读并理解此问题有关SO的信息,但我遇到的情况有所不同,其中给定的解决方案似乎无法正常工作.以下是不同的操作:

I've read and understood this question here on SO, but I have a somewhat different situation in which the given solution does not seem to work properly. The following is done differently:

  • 我正在使用WixNetFxExtension确定是否已将.NET 3.5安装为启动条件.​​
  • 我正在使用WixUtilExtension为32位/64位版本配置内容,如此处
  • I'm using the WixNetFxExtension to determine whether .NET 3.5 is installed as a startup condition.
  • I'm using the WixUtilExtension to configure stuff for 32-bit/64-bit builds as it is described here
  • 我想做的是:在进行32位安装时使用32位框架的事件消息文件,否则使用64位框架的事件消息文件.

    What I'd like to do is: use the 32-bit framework's event message file when doing a 32-bit install, otherwise use the 64-bit framework's event message file.

    上面链接的SO问题中的一条评论建议使用以下内容使系统使用32位框架的事件消息文件:

    One of the comments in the above linked SO question suggests to use the following to have the system use the 32-bit framework's event message file:

    <util:EventSource Log="Application" Name="*source name*" EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll"/>

    我对此进行了修改,以适应两种类型的设置:

    I modified this to account for both types of setups:

    <?if $(var.Platform) = x64 ?> <util:EventSource Log="..." Name="..." EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR64]EventLogMessages.dll" /> <?else ?> <util:EventSource Log="..." Name="..." EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll" /> <?endif ?>

    在文件的开头,相同的<?if ...条件条件起作用,并相应地更改产品名称和文件夹名称.

    At the beginning of the file, the same <?if ... conditional works, changing product- and foldernames accordingly.

    该代码上方的某些行我在使用以下代码来检测.NET Framework:

    Some lines above that code I'm using the following to allow for .NET Framework detection:

    <PropertyRef Id="NETFRAMEWORK35"/> <PropertyRef Id="NETFRAMEWORK20"/> <Condition Message="..."> <![CDATA[Installed OR NETFRAMEWORK35]]> </Condition>

    运行安装程序时,一切似乎都可以正常运行,也创建了事件源,我也可以从应用程序中使用它,但是,我仍然得到未找到事件消息文件的信息.检查注册表我发现消息文件的路径丢失:

    When I run the installer, everything seems to work, the event source is created, too, I can also use it from my application, however, I still get the information that the event message file is not found. Inspecting the Registry I found that the path to the message file is missing:

    EventMessageFile REG_EXPAND_SZ EventLogMessages.dll

    我希望也能提供32位/64位框架的路径,但是它似乎并不在前.

    I'd expect the path to the 32-bit/64-bit framework to be present, too, but it doesn't seem to be prepended.

    我在这里做什么错了?

    推荐答案

    我刚刚遇到了这个问题,您需要PropertyRef NETFRAMEWORK20INSTALLROOTDIR和NETFRAMEWORK20INSTALLROOTDIR64(还要确保引用了WinNetFxExtension).

    I just ran into this, you need to PropertyRef NETFRAMEWORK20INSTALLROOTDIR and NETFRAMEWORK20INSTALLROOTDIR64 (also make sure WinNetFxExtension is referenced).

    更多推荐

    WIX:使用.NET消息文件创建EventSource

    本文发布于:2023-11-12 00:50:38,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1580035.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:消息   文件   WIX   NET   EventSource

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!