2016-12-14 15 views
1

のWiXツールセット3.10を使用して、およびなどによって、heat.exeユーティリティで収穫されている特定のファイルへのショートカットを作成しようとしている:heat.exeで収穫したファイルへのショートカットを作成するには?

"%WIX%\bin\heat.exe" dir SourceDir -nologo -platform x64^
-ke -gg -g1 -suid -srd -scom -sreg -dr INSTALLDIR^
-cg ProjFiles -out ProjFiles.wxs 

私の問題:

  1. 私はXSLTファイルを変換するためにXSLTファイルを使用することになっていることを知っていますProjFiles.wxs-tオプションのheat.exe)、それを書く方法に関するWiX固有のドキュメントは存在しません:Id "Prog.exe"のデスクトップにShortcutを追加する例を挙げてください。そのため、同じId(すなわち「file.txtなどを共有します-g1フラグ、同じベース名を共有するファイル(例えば "SOURCEDIR \ DIRA \ file.txtなど" と "SOURCEDIR \ dirZ \ file.txtなど")の

  2. ");どうやってこれが競合ではなく、.MSIがどのように構築され、正常に実行されるのか見ていますか?

答えて

0

これでデスクトップにショートカットが作成されます。ショートカットはProg.exeファイルのコンポーネントと同じコンポーネントではないので無視しても安全です(警告をエラーとして処理した場合は、ICEをSuppress specific ICE validationsリストに追加してください)。 (Visual Studioでのプロパティツール設定をwixproj wixprojで<SuppressIces>タグまたは、-sice:CMDラインでICE ##)

、コンポーネント

を持っているディレクトリの定義

<Directory Id="TARGETDIR" Name="SourceDir"> 
    ... 
    <Directory Id="DesktopFolder"/> 
    ... 
</Directory> 

であなたのDesktopFolderを定義します

<Component Id="ProgDesktopShortcut"> 
    <Shortcut 
     Id="ProgDesktopShortcut" 
     Directory="DesktopFolder" 
     Target="[#Prog.exe]" 
     Name="Prog Shortcut" 
     WorkingDirectory="INSTALLDIR" > 
    </Shortcut> 
    <RegistryValue 
     Id="ProgDesktopRegShortcut" 
     Root="HKCU" 
     Key="SOFTWARE\Prog\" 
     Name="ProgInstall" 
     Type="integer" 
     Value="1" 
     KeyPath="yes"/>  
</Component>  
2

WiX固有のフォーメーションは文書化されていますが、十分なXSLだけを学ぶことは少し難題です。これはあなたを始めるはずです。

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

    <xsl:output 
    encoding="utf-8" 
    method="xml" 
    version="1.0" 
    indent="yes"  
    /> 

    <xsl:template match='wix:Component[contains(wix:File/@Source, "SourceDir\Prog.exe")]'> 
    <!-- assumes there is only one Prog.exe --> 
    <xsl:copy> 
     <xsl:apply-templates select="@*|node()"/> 
     <xsl:comment> added shortcut under Component with File that has Source with Prog.exe </xsl:comment> 
     <!-- Elsewhere, have an Icon element like: <Icon Id="Prog.exe" SourceFile="$(var.BUILDCACHE)Bin/Prog.exe" /> --> 
     <Shortcut 
     Id="ProgExeShortcut" 
     Name="Prog Application" 
     Icon="Prog.exe" 
     Directory="ProgramMenuFolder_ProgVendor" 
     Advertise="yes"> 
     <xsl:attribute name="WorkingDirectory"><xsl:value-of select="@Directory"/></xsl:attribute> 
     </Shortcut> 
     <RemoveFolder 
     Id="ProgExeShortcut_ProgramMenuFolder_ProgVendor" 
     Directory="ProgramMenuFolder_ProgVendor" 
     On="uninstall" /> 
    </xsl:copy> 
    </xsl:template> 

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

    <xsl:template match='/'> 
    <xsl:comment>*** DO NOT EDIT: Generated by heat.exe; transformed by ProgComponentGroup.xsl</xsl:comment> 
    <xsl:apply-templates select="@*|node()"/> 
    </xsl:template> 

</xsl:stylesheet> 

より具体的で以前のテンプレートは、より一般的なものや後のものよりも前にマッチします。したがって、基本は、変更したいものを除き、すべての要素、属性、テキスト、コメントをそのままコピーすることです。変更する要素については、すべての要素を再構成します。この場合は、Component要素のすべてをコピーしてから、Shortcut要素とRemoveFolder要素を追加します。

関連する問題