Marcio Martins
Marcio Martins

Reputation: 340

ERROR: The Component element contains an unhandled extension element 'XmlFile' on Wix Toolset v4.0.0

Hope to find you well.

I'm building a installer to a Windows Service using Wix Toolset v4.0.0, and I referenced a .config "File" inside a "Component" element. After it, I put a "util:XmlFile" element to create a tag into the "File" above. It should append an "add" tag to application settings and write some information passed in the installation process.

I believe I made all right, but I'm stuck with a compilation error:

ERROR WIX0200: The Component element contains an unhandled extension element 'XmlFile'. Please ensure that the extension for elements in the 'http://schemas.microsoft.com/wix/UtilExtension' namespace has been provided.

I've already set this namespace inside my Wix tag, but it doesn't work at all.

Here is my Fragment:

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <?define App_TargetDir=$(var.App.TargetDir)?>
    <Fragment>
        <ComponentGroup Id="AppComponents" Directory="INSTALLFOLDER">
            <Component Id="App.exe" Guid="05fff226-5acd-4a40-912b-7bc4176d5c47">
                <File Id="App.exe" Name="App.exe" Source="$(var.App_TargetDir)App.exe" />
                <ServiceInstall Name="AppService" DisplayName="Gestão de Ativos" Type="ownProcess" Start="auto" ErrorControl="normal" />
                <ServiceControl Name="AppService" Start="install" Stop="both" Remove="uninstall" />
            </Component>
            <Component Id="App.exe.config" Guid="39a8b8f7-55d0-4364-ad0b-dc8418f3b284">
                <File Id="App.exe.config" Name="App.exe.config" Source="$(var.App_TargetDir)App.exe.config" />
                <util:XmlFile Id="ConfigFileAddName" File="App.exe.config" Name="add" Action="createElement" ElementPath="/configuration/appSettings" Sequence="1"/>
                <util:XmlFile Id="ConfigFileValueTenant" File="App.exe.config" Name="Value" Action="setValue" ElementPath="/configuration/appSettings/add[@Key='Name']" Value="[Name]" Sequence="2"/>
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

The error happens in line 13 and 14 (where is the "util:XmlFile" elements).

I just don't know how to go any further. Please help!

Upvotes: 1

Views: 1936

Answers (1)

Bob Arnson
Bob Arnson

Reputation: 21896

The WixToolset.Util.wixext namespace in WiX v4 is http://wixtoolset.org/schemas/v4/wxs/util:

https://wixtoolset.org/docs/schema/util/

Upvotes: 4

Related Questions