I'm building a WiX installer for an application, using burn and the WixStandardBootstrapperApplication type. This installer installs .NET 4.6.2, SQL Server, the database schema, and the application. I'm pretty sure that everything but the application works, but I can't test, because I'm getting the following error when building the application MSI:
The File element contains an unhandled extension element 'Shortcut'.
Please ensure that the extension for elements in the '' namespace has been provided.
Now, everything I've read says I just need to add -ext <DLL for the namespace> to the build command, and everything will work out. Sadly, with no namespace listed, I can't do this.
I generate the MSI in its own project, the details of which are here (sanitized):
I'm generating the list of components through heat.exe in a pre-build event. Here's that command:
"%WIX%bin\heat" dir "APPLICATIONDIR\bin\Release" -gg -cg Application32 -scom -sreg -sfrag -srd -dr INSTALLDIR -var "var.SourceDir" -t ../../Application.xslt -out "..\..\Fragments\Application.wxs"
Product.wxs:
<xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="Installer32"
Language="1033"
Version="1.0.0.0"
Manufacturer="Company Name"
UpgradeCode="YOURGUID-12D0-4836-99F0-CB0C14264423">
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine" />
<Media Id="1"
Cabinet="Application.cab" />
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="ProductFeature"
Title="Installer32"
Level="1">
<ComponentGroupRef Id="Application32" />
<ComponentRef Id="ApplicationStartMenuShortcut"/>
</Feature>
</Product>
<Fragment>
<!-- ProgramFiles directory-->
<Directory Id="TARGETDIR"
Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="CompanyFolder"
Name="Company">
<Directory Id="INSTALLDIR"
Name="Application">
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Product Name" />
</Directory>
</Directory>
</Fragment>
</Wix>
Application.xslt:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="wix">
<xsl:output method="xml" indent="yes" />
<!-- This modifies the auto-generated Component for the executable to add shortcuts to start menu and desktop -->
<xsl:template match='wix:Wix/wix:Fragment/wix:DirectoryRef/wix:Component/wix:File[@Id and (@Id = "filAE9755507C00040964294096392BF6A2")]'>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<Shortcut Id="ApplicationDesktopShortcut"
Directory="ApplicationProgramsFolder"
Name="Application"
Advertise="yes" />
</xsl:copy>
</xsl:template>
<!-- Identity template: copies everything without change -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
EDIT: Added output of HEAT:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALLDIR">
[ SNIPPED MANY ]
<Component Id="cmpE60EA55C613C91D5119575B9B63102FB" Guid="{7A9A6D6D-960F-4ADB-8DC8-7A09FED71D48}">
<File Id="filAE9755507C00040964294096392BF6A2" KeyPath="yes" Source="$(var.SourceDir)\Application.exe"><Shortcut Id="ApplicationDesktopShortcut" Directory="ApplicationProgramsFolder" Name="Application" Advertise="yes" xmlns="" /></File>
</Component>
<Component Id="cmpA0604D18A00382A0CB4E004C7C2286DA" Guid="{538403B0-09ED-46C7-AD94-403C05ADAB56}">
<File Id="fil2F48795734FE3514952453321B4758C3" KeyPath="yes" Source="$(var.SourceDir)\Application.exe.config" />
</Component>
[ SNIPPED MANY ]
<Directory Id="dir43A0033346A51A6633F88C79EA143D36" Name="da">
<Component Id="cmp46F002450D6F653B36DCD369206685B4" Guid="{64EC22D1-B0ED-49E1-979E-7B8F54C558E3}">
<File Id="fil85957091B9F72CCAF0CF1D59748A6046" KeyPath="yes" Source="$(var.SourceDir)\da\Product.Utilities.resources.dll" />
</Component>
</Directory>
[ SNIPPED MANY ]
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="Application32">
[ SNIPPED MANY ]
<ComponentRef Id="cmpE60EA55C613C91D5119575B9B63102FB" />
<ComponentRef Id="cmpA0604D18A00382A0CB4E004C7C2286DA" />
[ SNIPPED MANY ]
<ComponentRef Id="cmp46F002450D6F653B36DCD369206685B4" />
[ SNIPPED MANY ]
</ComponentGroup>
</Fragment>
</Wix>
The only other SO question that has a blank namespace is this one: Migrating from WiX 3.10 to WiX 4.0: unhandled extension element. The solution in that does not apply to this question, as I'm not using the Registry element, nor am I switching to WiX 4. I may be using another element that's deprecated, I don't believe I am.
Any hints as to the path forward would be appreciated. Thanks.
Try adding xmlns="http://schemas.microsoft.com/wix/2006/wi"
to your xsl:stylesheet
element to put the Shortcut
element in the proper namespace.
It should look like this...
<xsl:stylesheet version="2.0"
xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="wix">