我正在使用刻录和WixStandardBootstrapperApplication类型为应用程序构建WiX安装程序。此安装程序将安装.NET 4.6.2,SQL Server,数据库架构和应用程序。我很确定除了应用程序之外的所有东西都可以工作,但我无法测试,因为在构建应用程序MSI时出现以下错误:
The File element contains an unhandled extension element 'Shortcut'.
Please ensure that the extension for elements in the '' namespace has been provided.
现在,我读过的所有内容都说我只需要为命名空间添加-ext< DLL>到构建命令,一切都会成功。可悲的是,没有列出名称空间,我不能这样做。
我在自己的项目中生成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>
编辑:添加了热量输出:
<?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问题是这一个: Migrating from WiX 3.10 to WiX 4.0: unhandled extension element。解决方案不适用于这个问题,因为我没有使用Registry元素,也没有切换到WiX 4.我可能正在使用另一个被弃用的元素,我不相信我。
任何有关前进道路的提示都将受到赞赏。感谢。
答案 0 :(得分:0)
尝试将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">