2011-11-07 13 views
10

Windowsサービス用のWiXインストーラを作成しようとしていますが、私のすべてのファイルに対してkeyPathを "no"私のWiXスクリプトの.exeの例外。 私は現在、ここにHeat.exeを使用して、私のディレクトリとファイル構造を生成していますが、私のコマンドです:WiXインストーラ:heat.exeでxsltを使用して属性を更新する

"$(WIX)bin\heat.exe" dir $(SolutionDir)EmailGenerationService\bin\PROD 
        -cg EmailGenFiles -gg -scom -sreg -sfrag -srd -suid 
        -dr INSTALLLOCATION -var var.FileSource 
        -t $(Projectdir)KeyPathTransform.xslt 
        -out $(ProjectDir)DirectoryAndFileComponents.wxs 

私のDirectoryAndFileComponents.wxsファイルにキーパス=」no」を持つすべてのファイルの要素を更新するために私の意図です。 熱からの出力のサンプルである:ここ

<?xml version="1.0" encoding="utf-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <Fragment> 
    <DirectoryRef Id="INSTALLLOCATION"> 
     <Component Id="Dollar.Common.dll" Guid="{2BCD0767-2383-47CF-B1BF-325FA4A3264F}"> 
     <File Id="Dollar.Common.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.dll" /> 
     </Component> 
     <Component Id="Dollar.Common.Exceptions.dll" Guid="{B7238091-76D1-42F5-A3B4-A539DFF3BD92}"> 
     <File Id="Dollar.Common.Exceptions.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.dll" /> 
     </Component> 
     <Component Id="Dollar.Common.Exceptions.pdb" Guid="{43711979-747D-49C9-BAE4-ECD44FAF5E67}"> 
     <File Id="Dollar.Common.Exceptions.pdb" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.pdb" /> 
     </Component> 
     <Component Id="Dollar.Common.Logging.dll" Guid="{59F9ABF3-5F68-410C-BC96-0556282F1E04}"> 
     <File Id="Dollar.Common.Logging.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Logging.dll" /> 
     </Component> 

私は変換を実行するように加熱するために通過していXSLTである:

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
      exclude-result-prefixes="msxsl" 
      xmlns:wix="http://schemas.microsoft.com/wix/2006/wix" 
      xmlns:my="my:my"> 

    <xsl:output method="xml" indent="no"/> 

    <xsl:strip-space elements="*"/> 

    <xsl:template match="@*|node()"> 
    <xsl:copy> 
     <xsl:apply-templates select="@*|node()"/> 
    </xsl:copy> 
    </xsl:template> 

    <xsl:template match='/wix:Wix/wix:Fragment/wix:DirectoryRef/wix:Component/wix:File[@Id and not (@Id="EmailGenerationService.exe")]'> 
    <xsl:attribute name="KeyPath"> 
      <xsl:value-of select="no"/> 
    </xsl:attribute> 
    </xsl:template> 
</xsl:stylesheet> 

Iは、他に基づいて本のかなりの数の変化を試みましたこのサイトや他の場所に投稿していますが、まだ、heat.exeによって作成されたファイルをKeyPath = "no"にすることができませんでした。

明らかなものがありませんか?

答えて

11

あなたは異なる規定の名前空間を持っている:XMLで

  1. :_ XSLTでhttp://schemas.microsoft.com/wix/2006/wi
  2. http://schemas.microsoft.com/wix/2006/wix

私が知っているように、WiXのための正しい名前空間はhttp://schemas.microsoft.com/wix/2006/wiです。したがって、XSLTを修正する必要があります。

XSLT:

<xsl:stylesheet version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
      exclude-result-prefixes="msxsl" 
      xmlns:wix="http://schemas.microsoft.com/wix/2006/wi" 
      xmlns:my="my:my"> 

    <xsl:output method="xml" indent="yes" /> 

    <xsl:strip-space elements="*"/> 

    <xsl:template match="@*|node()"> 
     <xsl:copy> 
      <xsl:apply-templates select="@*|node()"/> 
     </xsl:copy> 
    </xsl:template> 

    <xsl:template match='wix:Wix/wix:Fragment/wix:DirectoryRef/wix:Component/wix:File[@Id and not (@Id = "EmailGenerationService.exe")]'> 
     <xsl:copy> 
      <xsl:apply-templates select="@*"/> 
      <xsl:attribute name="KeyPath"> 
       <xsl:text>no</xsl:text> 
      </xsl:attribute> 
     </xsl:copy> 
    </xsl:template> 
</xsl:stylesheet> 

入力XML:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <Fragment> 
     <DirectoryRef Id="INSTALLLOCATION"> 
      <Component Id="Dollar.Common.dll" Guid="{2BCD0767-2383-47CF-B1BF-325FA4A3264F}"> 
       <File Id="Dollar.Common.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.dll" /> 
      </Component> 
      <Component Id="Dollar.Common.Exceptions.dll" Guid="{B7238091-76D1-42F5-A3B4-A539DFF3BD92}"> 
       <File Id="Dollar.Common.Exceptions.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.dll" /> 
      </Component> 
      <Component Id="Dollar.Common.Exceptions.pdb" Guid="{43711979-747D-49C9-BAE4-ECD44FAF5E67}"> 
       <File Id="Dollar.Common.Exceptions.pdb" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Exceptions.pdb" /> 
      </Component> 
      <Component Id="Dollar.Common.Logging.dll" Guid="{59F9ABF3-5F68-410C-BC96-0556282F1E04}"> 
       <File Id="Dollar.Common.Logging.dll" KeyPath="yes" Source="$(var.FileSource)\Dollar.Common.Logging.dll" /> 
      </Component> 
     </DirectoryRef> 
    </Fragment> 
</Wix> 

出力XML:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
    <Fragment> 
    <DirectoryRef Id="INSTALLLOCATION"> 
     <Component Id="Dollar.Common.dll" Guid="{2BCD0767-2383-47CF-B1BF-325FA4A3264F}"> 
     <File Id="Dollar.Common.dll" Source="$(var.FileSource)\Dollar.Common.dll" KeyPath="no" /> 
     </Component> 
     <Component Id="Dollar.Common.Exceptions.dll" Guid="{B7238091-76D1-42F5-A3B4-A539DFF3BD92}"> 
     <File Id="Dollar.Common.Exceptions.dll" Source="$(var.FileSource)\Dollar.Common.Exceptions.dll" KeyPath="no" /> 
     </Component> 
     <Component Id="Dollar.Common.Exceptions.pdb" Guid="{43711979-747D-49C9-BAE4-ECD44FAF5E67}"> 
     <File Id="Dollar.Common.Exceptions.pdb" Source="$(var.FileSource)\Dollar.Common.Exceptions.pdb" KeyPath="no" /> 
     </Component> 
     <Component Id="Dollar.Common.Logging.dll" Guid="{59F9ABF3-5F68-410C-BC96-0556282F1E04}"> 
     <File Id="Dollar.Common.Logging.dll" Source="$(var.FileSource)\Dollar.Common.Logging.dll" KeyPath="no" /> 
     </Component> 
    </DirectoryRef> 
    </Fragment> 
</Wix> 
+0

回答ありがとうございますが、これも機能していません。熱はエラーなしで正常に実行されますが、生成されるファイルにはすべてのノードでKeyPath = "yes"が保持されます。 –

+0

@MarkJones、私は私の答えを更新しました。 –

+1

完璧、ありがとうございます –

2

私はあなたの元の質問に答えています。 :)

私はあなたが誤解されたと思います、私は「ノー」すべての私のファイルのためにキーパスを設定するnnedこと.exeの

の例外を除いて を読みました。 ServiceInstall tableカラムComponent_を有し、MSDNによれば、実際には:

InstallServiceテーブルを使用してこのサービスをインストールするには、このコンポーネントのキーパス は、サービスの実行可能ファイルでなければなりません。

他のコンポーネントの非exeファイルには@KeyPath='no'が含まれている必要はありません。サービスのEXEファイルは別のコンポーネントに置かれ、そのキーパスでなければなりません。

キーパスは、MSIテクノロジの非常に重要な概念です。あなたはそれについての詳細を読むことができますhere, see the description of the KeyPath column

元の質問に戻ると、いいえ、熱の出力を微調整する必要はありません。デフォルトで必要なWiXオーサリングが生成されます。

+0

情報のおかげでヤン、私はここから私の噂を取った:http://blog.tentaclesoftware.com/archive/2009/01/01/21.aspx –

+0

参照するサンプルでは、​​単一のコンポーネントにはいくつかのファイルが含まれています。 KeyPath = 'yes'としてマークできるファイルは1つだけですが、明示的にKeyPath = 'no'とマークする必要はありません。そして、あなたのために生成されたサンプルのheat.exeでは、あなたの前提は完全に間違っています。 –

+0

@マークジョーンズ、私の前のコメントが厳しい形式で表現されている場合は申し訳ありません。私は人々が時間と努力を費やして存在しない問題を解決しようとしているのを見て反応するのを抵抗することはできません:) –

1

私は別のアプローチを提案してもよいですか?

<xsl:template match="@KeyPath[parent::wix:File[parent::wix:Component[parent::wix:DirectoryRef[parent::wix:Fragment[parent::wix:Wix]]]] and . != 'EmailGenerationService.exe']"> 
     <xsl:attribute name="KeyPath"> 
      <xsl:value-of select="'no'"/> 
     </xsl:attribute> 
</xsl:template> 

テンプレートの一致を上記のものに変更するだけで、正しい結果が得られます。

関連する問題