Util Extension problems

Sep 28, 2016 at 12:13 AM
Hi

I am having a problem using the Event Source element from the util Extension assembly.

My C# code
static void Main(string[] args)
{
    var project = new Project("NamespaceTest", new Dir(@"%ProgramFiles%\Test") {IsInstallDir = true});

    project.IncludeWixExtension(WixExtension.Util);
    project.AddXmlInclude(@"C:\Temp\EventRegistration.wxi");

    Compiler.BuildMsi(project);
}
and my wxi file.
<Include>
    <Component Id="EventSourceId" Guid="{FFFFFFFF-F53E-48A2-B24B-9D410448FC39}" KeyPath="yes" SharedDllRefCount="yes" Directory="INSTALLDIR">
        <util:EventSource  Name="Custom Event Source" Log="Application" EventMessageFile="SomeAssembly.dll" />
    </Component>
</Include>
When I compile and run the code I the build fails and says 'util' is an undeclared prefix in file. When i look in the generated .wxs file the namespace is missing in the Wix element event though i set it to include the extension.

Does anyone know how to make this work in any way? It would also be nice to know to use all the other wix extension that are not yet in the Wix# code.


Have a great day,
Tomas
Coordinator
Sep 28, 2016 at 12:58 AM
Thank you,

It is a defect. It is in fact a side effect of issue#63 fix, which after regeneration of the the whole XML doc doesn't reintroduces the original namespaces.
I am promoting your post into an issue.

Until the fix is available unfortunately the only choice you have is to use WixSourceGenerated event where you can manually add namespace. See InjectXML sample.
Coordinator
Sep 28, 2016 at 12:58 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Sep 28, 2016 at 1:11 AM
The fix was simple and it is done already.
If you really keen you can grab "src\WixSharp.Samples\WixSharp.UI.dll" v1.0.43.2 from Git. It already contains the fix. But I will not have time to do the NuGet release until next week.

> It would also be nice to know to use all the other wix extension that are not yet in the Wix# code.
Your code is absolutely correct. It is the way of integrating the WiX extensions. It's just that Wix# defect prevented you from succeeding.