2011-08-24 27 views
4

我在運行時使用Heat來生成將要安裝的組件。有幾個文件需要複製。但每次我使用<CopyFile>沒有FileId屬性時,它在運行時失敗Error 2716: Couldn't create a random subcomponent name for component 'copyFile'WIX錯誤2716:無法爲組件'CopySTST'創建隨機子組件名稱

我無法使用FileId,因爲它在設計時不知道。

+0

您是否找到解決方案? – Ivan

回答

-2

使用paraffin或自定義操作

  • 石蠟

%1\Paraffin.exe -dir "..\..\AppFolder" -dirref INSTALLLOC -custom COMPONENTNAME ..\..\ApplicationFragment.wxs -guids -ext .csproj -ext .cs -direXclude obj -direXclude "bin\Config" -direXclude Properties -multiple

  • 自定義操作

在customaction添加

<CustomAction Id="A_SetQtCmdLineCopyFiles" Property="QtExecCmdLine" 
       Value="&quot;[SystemFolder]cmd.exe&quot; /c copy &quot;[INSTALLLOC]AppFolder\FileName&quot; &quot;[TARGETDIR]&quot;" /> 
<CustomAction Id="QtCmdCopyFiles" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore" /> 

然後在Product.wxs添加

<Custom Action="GA_SetQtCmdLineCopyFiles" After="InstallFinalize">NOT INSTALLED AND NOT REMOVE</Custom> 
<Custom Action="QtCmdCopyFiles" After="GA_SetQtCmdLineCopyFiles">NOT INSTALLED AND NOT REMOVE</Custom> 
+1

僅當沒有其他選項時才應使用自定義操作。這是所謂的「最後的手段」。以這種特殊的方式,你建議以非常殘酷的方式重新發明車輪:-)相反,通常要更好地挖掘問題的確切原因並加以解決。有關自定義操作的更多信息,請訪問http://blogs.msdn.com/b/heaths/archive/2007/04/20/custom-action-guidelines.aspx和here(介紹部分):http://www.joyofsetup的.com/2010/02/08 /導入勒克斯陳述性-單元測試換定製動作/ –

0

您可以將輸出文件WXS使用XSL模板。這裏有-t:切換熱命令行選項。在該模板中,您可以將元素添加到正確的組件,並避免您面臨的「Id未知」問題。

相關問題