WiX 安装程序 3.11:元素包含带有空白命名空间的未处理扩展元素
WiX installer 3.11: element contains an unhandled extension element with blank namespace
我正在为应用程序构建 WiX 安装程序,使用 burn 和 WixStandardBootstrapperApplication 类型。此安装程序安装 .NET 4.6.2、SQL 服务器、数据库模式和应用程序。我很确定除了应用程序以外的所有东西都可以工作,但我无法测试,因为在构建应用程序 MSI 时出现以下错误:
The File element contains an unhandled extension element 'Shortcut'.
Please ensure that the extension for elements in the '' namespace has been provided.
现在,我读到的所有内容都说我只需要将 -ext 添加到构建命令,一切都会成功。遗憾的是,由于没有列出名称空间,我无法执行此操作。
我在自己的项目中生成了 MSI,详细信息在这里(已清理):
我在预构建事件中通过 heat.exe 生成组件列表。这是该命令:
"%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>
编辑:添加了 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>
唯一一个具有空白命名空间的其他 SO 问题是:
。其中的解决方案不适用于这个问题,因为我没有使用注册表元素,也没有切换到 WiX 4。我可能正在使用另一个已弃用的元素,我不相信我是。
如能提供有关前进道路的任何提示,我们将不胜感激。谢谢。
尝试将 xmlns="http://schemas.microsoft.com/wix/2006/wi"
添加到 xsl:stylesheet
元素以将 Shortcut
元素放入正确的命名空间。
应该是这样的...
<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">
我正在为应用程序构建 WiX 安装程序,使用 burn 和 WixStandardBootstrapperApplication 类型。此安装程序安装 .NET 4.6.2、SQL 服务器、数据库模式和应用程序。我很确定除了应用程序以外的所有东西都可以工作,但我无法测试,因为在构建应用程序 MSI 时出现以下错误:
The File element contains an unhandled extension element 'Shortcut'.
Please ensure that the extension for elements in the '' namespace has been provided.
现在,我读到的所有内容都说我只需要将 -ext
我在自己的项目中生成了 MSI,详细信息在这里(已清理):
我在预构建事件中通过 heat.exe 生成组件列表。这是该命令:
"%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>
编辑:添加了 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>
唯一一个具有空白命名空间的其他 SO 问题是:
如能提供有关前进道路的任何提示,我们将不胜感激。谢谢。
尝试将 xmlns="http://schemas.microsoft.com/wix/2006/wi"
添加到 xsl:stylesheet
元素以将 Shortcut
元素放入正确的命名空间。
应该是这样的...
<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">