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.
I've read and unders开发者_运维问答tood 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:
- 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
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.
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 ?>
At the beginning of the file, the same <?if ...
conditional works, changing product- and foldernames accordingly.
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
I'd expect the path to the 32-bit/64-bit framework to be present, too, but it doesn't seem to be prepended.
What am I doing wrong here?
I just ran into this, you need to PropertyRef
NETFRAMEWORK20INSTALLROOTDIR
and NETFRAMEWORK20INSTALLROOTDIR64
(also make sure WinNetFxExtension is referenced).
精彩评论