WIX:使用.NET消息文件创建EventSource [英] WIX: Create EventSource using .NET message file

查看:101
本文介绍了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:

  1. 我正在使用WixNetFxExtension确定是否已将.NET 3.5安装为启动条件.​​
  2. 我正在使用WixUtilExtension为32位/64位版本配置内容,如
  1. I'm using the WixNetFxExtension to determine whether .NET 3.5 is installed as a startup condition.
  2. 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 NETFRAMEWORK20INSTALLROOTDIRNETFRAMEWORK20INSTALLROOTDIR64(还要确保引用了WinNetFxExtension).

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

这篇关于WIX:使用.NET消息文件创建EventSource的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆