So I'm trying to create a WiX installer in Visual Studio 2017 and have run into:
The Fragment element contains an unhandled extension element 'EventSource'. Please ensure that the extension for elements in the 'http://schemas.microsoft.com/wix/UtilExtension' namespace has been provided.3
I have installed the VS WiX Extension from here.
Some googling will turn up, this, one of these, some of this, and this, and this. As well as a few others that are only tangentially related.
Suffice it to say the majority of these resolve to 'Your forgot to add the reference to the WixUtilExtension.dll to your project'. Except for the last one which ends with "Never seen that good luck."
I am trying to add an EventSource and Log at install:
<Fragment>
<PropertyRef Id="NETFRAMEWORK40FULLINSTALLROOTDIR"/>
<PropertyRef Id="NETFRAMEWORK40FULLINSTALLROOTDIR64"/>
<PropertyRef Id="NETFRAMEWORK40CLIENTINSTALLROOTDIR"/>
<PropertyRef Id="NETFRAMEWORK40CLIENTINSTALLROOTDIR64"/>
<Util:EventSource
KeyPath="yes"
Name="SourceName"
Log="LogName"
SupportsErrors="yes"
SupportsWarnings="yes"
SupportsFailureAudits="yes"
SupportsSuccessAudits="yes"
SupportsInformationals="yes"
EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR]EventLogMessages.dll"
/>
</Fragment>
I have added the reference to the root Wix Element as:
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:Util="http://schemas.microsoft.com/wix/UtilExtension">
I have added a reference to the WixUtilExtension.dll from:
C:\Program Files (x86)\WiX Toolset v4.0\bin\WixUtilExtension.dll
I have also tried with a reference to the 3.11 version of said dll from:
C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUtilExtension.dll
I have checked the cmd line call and am indeed getting it added as an -ext pass argument (it's the second to last call if you want to verify):
C:\Program Files (x86)\WiX Toolset v4.0\bin\candle.exe -out obj\Release\ -d"DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\\" -d"SolutionDir=C:\TFS\Utilities\Program\\" -dSolutionExt=.sln -d"SolutionFileName=Program.sln" -d"SolutionName=NPA Task Scheduler" -d"SolutionPath=C:\TFS\Utilities\Program\Program.sln" -dConfiguration=Release -dOutDir=bin\Release\ -dPlatform=x86 d"ProjectDir=C:\TFS\Utilities\Program\WiX Setup\\" -dProjectExt=.wixproj d"ProjectFileName=WiX Setup.wixproj" -d"ProjectName=WiX Setup" -d"ProjectPath=C:\TFS\Utilities\Program\WiX Setup\WiX Setup.wixproj" -d"TargetDir=C:\TFS\Utilities\Program\WiX Setup\bin\Release\\" -dTargetExt=.msi -d"TargetFileName=Setup.msi" -d"TargetName=Setup" -d"TargetPath=C:\TFS\Utilities\Program\WiX Setup\bin\Release\Setup.msi" -d"Program.Configuration=Release" -d"HelperDLL.FullConfiguration=Release|AnyCPU" -d"HelperDLL.Platform=AnyCPU" -d"HelperDLL.ProjectDir=C:\TFS\Utilities\Program\HelperDLL\\" -d"HelperDLL.ProjectExt=.csproj" -d"HelperDLL.ProjectFileName=HelperDLL.csproj" -d"HelperDLL.ProjectName=HelperDLL" -d"HelperDLL.ProjectPath=C:\TFS\Utilities\Program\HelperDLL\HelperDLL.csproj" -d"HelperDLL.TargetDir=C:\TFS\Utilities\Program\HelperDLL\bin\Release\\" -d"HelperDLL.TargetExt=.dll" -d"HelperDLL.TargetFileName=HelperDLL.dll" -d"HelperDLL.TargetName=HelperDLL" -d"HelperDLL.TargetPath=C:\TFS\Utilities\Program\HelperDLL\bin\Release\HelperDLL.dll" -d"Service.Configuration=Release" -d"Service.FullConfiguration=Release|AnyCPU" -d"Service.Platform=AnyCPU" -d"Service.ProjectDir=C:\TFS\Utilities\Program\NPA Task Runner\\" -d"Service.ProjectExt=.csproj" -d"Service.ProjectFileName=NPA Task Runner.csproj" -d"Service.ProjectName=NPA Task Runner" -d"Service.ProjectPath=C:\TFS\Utilities\Program\Service\Service.csproj" -d"Service.TargetDir=C:\TFS\Utilities\Program\Service\bin\Release\\" -d"Service.TargetExt=.exe" -d"Service.TargetFileName=Service.exe" -d"Service.TargetName=Service" -d"Service.TargetPath=C:\TFS\Utilities\Program\Service\bin\Release\Service.exe" -arch x86 -ext "C:\Program Files (x86)\WiX Toolset v4.0\bin\\WixUtilExtension.dll" -ext "..\..\..\..\Users\me\Documents\Visual Studio 2017\Projects\Utils\Utils\bin\Debug\Utils.dll" Product.wxs
I have also checked and verified that the dll does indeed exist in those locations. IntelliSense also seems to recognize it and even provides tag help with CTRL+Space.
I'm at a bit of a loss at this point. I've added it, removed it, re-added it, changed it around, closed and re-opened the project, shut down and restarted the computer. Tried the xmlns ref call at the top and in the fragment directly holding the reference. I've tried with both the minimum number of arguments (3 according to this) and extras. Put the EventSource call in several different fragment elements, and it's own and nothing is working. I feel like I'm missing something incredibly obvious but I can't see it.
EDIT: I have just come across this recently. Which seems to point to different references:
http://wixtoolset.org/schemas/v4/wxs/util
Instead of:
http://schemas.microsoft.com/wix/UtilExtension
Didn't work either. Unfortunately their documentation on 4.0 is still incomplete/not posted. I looked it up in git hub and I didn't see any references to EventSource although IntelliSense is still showing it.
EDIT: I figured it out. Thanks to that post about the schema changes and some digging through the source on git.
First was the schema changes for 4.0. For those who find this through google and before they post their 4.0 ref docs, those changes can be found here. Next the EventSource required tag location seemed to have changed; was in a Fragment element in 3.0, now it has to be in a Component element. This got me to the second issue which is the use of default property values (the PropertyRef elements). You will need another wix reference:
xmlns:NetFX="http://wixtoolset.org/schemas/v4/wxs/netfx"
Note: This is also a part of the 3.0 to 4.0 change in schema's. Which also requires a dll reference to the WixNetFxExtention.dll in the 4.0 bin folder.