2

So I may not be doing this correct, but here it goes:

I have one application with references to 4 SQL Server assemblies

App must work against SQL 2008 and 2010.

The only way I've gotten this to work is, to have my app reference a 'generic' path for my SQL Assemblies. Then in my MSBuild project, I copy the 2008 assemblies to the 'generic' folder and compile my app. I do this again for the 2012.

I have a folder like Tools\Release\V2008 and Tools\Release\V2010. These folders have all the EXE and required DLLs (including the 4 sql server). I run HEAT against these folders.

However, when I run heat against each folder, with each having the same directory ID but different Component, I get 2 wxs files, each have the same files (expected) but each the component and file ids are identical in the 2 wxs files.

Example:

MSBuild Command:
    <Exec Command="&quot;$(WixTools)\heat.exe&quot; dir $(DeploymentRoot)\Tools\V2008 -dr TOOLS -cg Tools2008Component -var var.Tools2008Path -gg -scom -sreg -sfrag -srd  -o $(heatOutputPath)\cmp2008ToolsFrag.wxs"/>    

WXS File
    <DirectoryRef Id="TOOLS">
        <Component Id="cmp04831EC1F8BB21C028A7FC875720302F" Guid="*">
            <File Id="fil09727A8BFD32FDCE7C743D6DD2008E7C" KeyPath="yes" Source="$(var.Tools2008Path)\AL3Util.exe" />
        </Component>

MSBuild Command:
        <Exec Command="&quot;$(WixTools)\heat.exe&quot; dir $(DeploymentRoot)\Tools\V2012 -dr TOOLS -cg Tools2012Component -var var.Tools2012Path -gg -scom -sreg -sfrag -srd  -o $(heatOutputPath)\cmp2012ToolsFrag.wxs"/>

WXS file
    <DirectoryRef Id="TOOLS">
        <Component Id="cmp04831EC1F8BB21C028A7FC875720302F" Guid="*">
            <File Id="fil09727A8BFD32FDCE7C743D6DD2008E7C" KeyPath="yes" Source="$(var.Tools2012Path)\AL3Util.exe" />
        </Component>

How can I get each WXS file to have unique component and file IDs? Or - How can I do this better :)

Thanks!

4

1 に答える 1

7

を使用しているため、ID は同じになります-srd。ルート ディレクトリを非表示にします。この場合、ID の生成に使用されるパスはファイル名のみになり、同じ名前のファイルには同じ ID が生成されます。

2 つの選択肢があります。

1) heat を実行して でファイルを収集するときに、変換権を使用します-t

2) 収集後に XslTransform タスク (.NET 4) を使用して、ID を File_2012_AL3Util や File_2008_AL3Util などの名前に変更します。

この XSL をファイルに適用できます。以下の例では、ファイル名の「MyFile」とディレクトリ ID の「MyID」に一致する要素が削除されます。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:wi="http://schemas.microsoft.com/wix/2006/wi">

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

  <!-- Matches both directory name and file name. -->
  <!-- Matches any Component that has its @Directory with same @Id as Directory 'MyID'. -->
  <!-- Function ends-with does not work with heat. -->
  <xsl:template match="//wi:Component[@Directory=//wi:Directory[@Name='MyID']/@Id and substring(wi:File/@Source, string-length(wi:File/@Source) - string-length('MyFile') + 1) = 'MyFile']" />

</xsl:stylesheet>
于 2014-09-12T18:09:09.890 に答える