按照要求。使用 UtilExtension 在 .NET 4 full 和 .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>
3)64位部分:
<!-- 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>