2016-06-28 89 views
1

請任何人都可以提供完整的.wxs示例來創建MSI程序包?創建MSI安裝程序以使用Wix部署字體(在一個MSI中包括更多字體)

我已經閱讀此線程已經: How to install Open Type Fonts using Wix

但它並不能幫助我就好了。我會在那裏添加評論,但我沒有足夠的聲望點:/

有什麼不對?我收到以下錯誤:

D:\share\IT\install-MSI\MSI věvoj\fonty-2016>candle font-Gabka2.wxs 
Windows Installer XML Toolset Compiler version 3.10.2.2516 
Copyright (c) Outercurve Foundation. All rights reserved. 

font-Gabka2.wxs 
D:\share\IT\install-MSI\MSI věvoj\fonty-2016\font-Gabka2.wxs(14) : warning CNDL1091 : The Package/@Id attribute has been set. Setting this attribute will allow nonidentical .msi files to have the same package code. This may be a problem because the package code is the primary identifier used by the installer to search for and validate the correct package for a given installation. If a package is changed without changing the package code, the installer may not use the newer package if both are still accessible to the installer. Please remove the Id attribute in order to automatically generate a new package code for each new .msi file. 

D:\share\IT\install-MSI\MSI věvoj\fonty-2016>light font-Gabka2.wixobj 
Windows Installer XML Toolset Linker version 3.10.2.2516 
Copyright (c) Outercurve Foundation. All rights reserved. 

D:\share\IT\install-MSI\MSI věvoj\fonty-2016\font-Gabka2.wxs(34) : error LGHT0094 : Unresolved reference to symbol 'WixAction:InstallExecuteSequence/RemoveExistingProducts' in section 'Product:*'. 

源WXS文件代碼:

<?xml version='1.0'?> 
<?define ProductName = "Font Gabka2 (SVČ Lužánky)"?> 
<?define PrevProductVersion = "1.0"?> <!-- Match previous version, use "1.0.0" for new install if not known --> 
<?define ProductVersion = "1.0"?> <!-- Match new version --> 
<?define ProductCode = "PUT-GUID-HERE"?> <!-- Re-generate for new upgrade! (http://www.guidgen.com/) --> 
<?define ProductUpgradeCode = "PUT-GUID-HERE"?> <!-- When upgrading, overwrite with previous ProductCode here. --> 
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'> 
     <Product Id='*' 
       UpgradeCode="$(var.ProductUpgradeCode)" 
       Name="$(var.ProductName)" 
       Language='1033' 
       Version='$(var.ProductVersion)' 
       Manufacturer='SVČ Lužánky'> 
       <Package Id='$(var.ProductCode)' 
         Description='$(var.ProductName) $(var.ProductVersion)' 
         InstallerVersion='200' 
         Compressed='yes' /> 
       <Media Id='1' Cabinet='setup.cab' EmbedCab='yes' /> 

<Directory Id="TARGETDIR" Name="SourceDir"> 
    <Directory Id="FontsFolder"> 
    <Component Id="InstallFonts" Guid="*"> <!-- New GUID HERE FOR NEW FILE (no changes for upgrade, though) --> 
     <File Id="Gabka2.ttf" Source="Gabka2.ttf" TrueType="yes" KeyPath="yes" /> 
    </Component> 
    </Directory> 
</Directory> 

       <Upgrade Id="$(var.ProductUpgradeCode)"> 
         <UpgradeVersion Minimum="$(var.ProductVersion)" 
           IncludeMinimum="no" 
           OnlyDetect="yes" 
           Language="1033" 
           Property="NEWPRODUCTFOUND" /> 
         <UpgradeVersion Minimum="$(var.PrevProductVersion)" 
           IncludeMinimum="yes" 
           Maximum="$(var.ProductVersion)" 
           IncludeMaximum="no" 
           Language="1033" 
           Property="UPGRADEFOUND" /> 
       </Upgrade> 
       <Property Id="ARPSYSTEMCOMPONENT" Value="1" /> 
       <Feature Id='InstallFeature' Title='Install Feature' Level='1'> 
         <ComponentRef Id='InstallFonts' /> 
       </Feature> 

       <!-- Prevent downgrading --> 
       <CustomAction Id="PreventDowngrading" Error="Newer version already installed." /> 

       <InstallUISequence> 
         <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom> 
       </InstallUISequence> 
     </Product> 
</Wix> 

謝謝

PS:如何安裝更多的TTF字體在一個MSI?如果我添加更多的文件,我得到的錯誤是這樣的:

error CNDL0042 : The Component element has multiple key paths set. The key path may only be set to 'yes' in extension elements that support it or one of the following locations: Component/@KeyPath, File/@KeyPath, RegistryValue/@KeyPath, or ODBCDataSource/@KeyPath. 

PS2:我用這個項目https://github.com/pennmanor/wix-wrapper作爲模板基地爲我的新維克斯-MSI字體項目。

回答

2

有些是錯的事情:

不要讓包ID固定的,請使用「*」,讓你在每次構建一個新的價值。

對於降級預防,不需要自定義操作或升級元素。使用mainupgrade元素 - 它似乎有你需要的一切。

字體錯誤消息似乎不適用於您發佈的源,因爲它引用了組件中的多個文件。

+0

謝謝PhilDW的proble是但是,我不是WIX開發人員,而且我對XML格式和功能非常陌生,所以我不完全理解這意味着什麼「不需要爲降級預防定製操作或升級元素。使用majorupgrade元素「 - 如果有人可以在這裏或某處發佈功能性的WIX文件來創建MSI以部署字體,我將非常高興。有一個網站看起來像這樣(https://www.hass.de/) ,但它不起作用 - 源代碼僅包含部分行,大部分源代碼丟失:/ – crysman

+0

我已經解決了這兩個問題,稍後我會在這裏報告如何,現在沒時間了。 – crysman

1

這裏是解決這類問題:

1) 「... 錯誤CNDL0042:對構成要素有多個關鍵 ...」 的問題:

只是刪除了「的keyPath 「完全屬性,它沒有它的作品

2)多種字體:當1)完成時,包含更多字體並簡單地向」組件「子樹添加更多」文件「標籤是沒有問題的。謹防擁有唯一的ID。例如:

<Component Id="InstallFonts" Guid="a028a73b-xxxx-xxxx-xxxx-da4e3e03aef5"> <!-- New GUID HERE FOR NEW FILE (no changes for upgrade, though) --> 
    <File Id="Gabka2.ttf" Source="Gabka2.ttf" TrueType="yes" /> 
    <File Id="Gabka2_bold.ttf" Source="Gabka2_bold.ttf" TrueType="yes" /> 
</Component> 

3) 「...錯誤LGHT0094:未解析的參照符號...」 的問題:前剛剛

<InstallExecuteSequence> 
    <RemoveExistingProducts After="InstallFinalize" /> 
</InstallExecuteSequence> 

這是通過添加固定最終產品標籤。

4)編碼/字符/代碼問題(「...錯誤LGHT0311:提供了一個字符串...「):

通過增加固定 「代碼頁」 屬性的主要 「產品」 的標籤,那就是:

<Product Id='*' 
    Codepage="utf-8" 
    UpgradeCode="$(var.ProductUpgradeCode)" 
    Name="$(var.ProductName)" 
    Language='1033' 
    Version='$(var.ProductVersion)' 
... 

希望這有助於#crysman