2017-05-18 39 views
1

我正在使用burn和WixStandardBootstrapperApplication類型爲應用程序構建WiX安裝程序。此安裝程序將安裝.NET 4.6.2,SQL Server,數據庫架構和應用程序。我敢肯定,一切,但應用程序的工作,但我無法測試,因爲我正在創建的應用程序MSI時收到以下錯誤:WiX安裝程序3.11:元素包含空白名稱空間的未處理擴展元素

The File element contains an unhandled extension element 'Shortcut'. 
Please ensure that the extension for elements in the '' namespace has been provided. 

現在,一切我讀過說,我只是需要爲命令空間>添加-ext < DLL到生成命令,並且一切都會生效。可悲的是,沒有列出名稱空間,我無法做到這一點。

我產生了微星在自己的項目,該項目的細節在這裏(消毒):

我通過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> 

唯一的其他所以有一個空白的命名空間是這個問題ne: Migrating from WiX 3.10 to WiX 4.0: unhandled extension element。這個問題的解決方案並不適用於這個問題,因爲我沒有使用註冊表元素,也沒有切換到WiX 4.我可能會使用另一個已過時的元素,我不相信我。

任何有關前進道路的提示將不勝感激。謝謝。

+0

我跑wixcop我WXS。它只是抱怨我的代碼格式。沒有被棄用的元素。 –

+1

嘗試在您的'xsl:stylesheet'元素中添加'xmlns =「http://schemas.microsoft.com/wix/2006/wi」',將'Shortcut'元素放入正確的名稱空間。 –

+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"> 
相關問題