2010-12-08 95 views
7

ILMerge +本地化資源集合

  • \ BIN \調試\ test.exe的
  • \斌\調試\ NL-BE \ test.resources.dll
  • \ BIN \調試\ FR-FR \ test.resources.dll

這是一個與1個表格(Form1.cs的)一個簡單的測試項目,沒什麼特別的。 我的目標是創建一個具有工作資源管理器的單一程序集應用程序(我已閱讀ILMerge and localized resource assembliesSingle-assembly multi-language Windows Forms deployment (ILMerge and satellite assemblies/localization) - possible?瞭解如何執行此操作的信息)。

編譯項目後,我跑ILMerge使用以下命令行參數:

ilmerge /log:test.txt /target:winexe /copyattrs /allowdup /out:test_merged.exe 
"C:\projectdir\bin\Debug\test.exe" "C:\projectdir\bin\Debug\fr-FR\test.resources.dll" 
"C:\projectdir\bin\Debug\nl-BE\test.resources.dll" 

如果我請與反射合併程序集的內容,我看到資源樹節點下以下幾點:

  • test.Form1.fr-FR.resources
  • test.Form1.fr-FR.resources
  • test.Form1.resources
  • test.Properties.Resources.resources

取而代之的是FR-FR和NL-BE資源,我有2倍的FR-FR資源。這是因爲資源DLL具有相同的名稱?結果是我只能在運行時獲得fr-FR資源。

任何想法?

更新(日誌文件內容): (注:二進制文件的前綴「loc_」,我給他們留下了我在以前的帖子爲清楚起見)

ILMerge version 2.10.526.0 
Copyright (C) Microsoft Corporation 2004-2006. All rights reserved. 
ILMerge /log:loc_test.txt /target:winexe /copyattrs /allowdup /out:loc_test_merged.exe c:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\loc_test.exe C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\fr-FR\loc_test.resources.dll C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\nl-BE\loc_test.resources.dll 
Set platform to 'v2', using directory 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\..\v2.0.50727' for mscorlib.dll 
Running on Microsoft (R) .NET Framework v2.0.50727 
mscorlib.dll version = 2.0.0.0 
The list of input assemblies is: 
    c:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\loc_test.exe 
    C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\fr-FR\loc_test.resources.dll 
    C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\nl-BE\loc_test.resources.dll 
Trying to read assembly from the file 'c:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\loc_test.exe'. 
    Successfully read in assembly. 
    There were no errors reported in loc_test's metadata. 
Trying to read assembly from the file 'C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\fr-FR\loc_test.resources.dll'. 
Can not find PDB file. Debug info will not be available for assembly 'C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\fr-FR\loc_test.resources.dll'. 
    Successfully read in assembly. 
    There were no errors reported in loc_test.resources's metadata. 
Trying to read assembly from the file 'C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\nl-BE\loc_test.resources.dll'. 
Can not find PDB file. Debug info will not be available for assembly 'C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\nl-BE\loc_test.resources.dll'. 
    Successfully read in assembly. 
    There were no errors reported in loc_test.resources's metadata. 
Checking to see that all of the input assemblies have a compatible PeKind. 
    loc_test.PeKind = ILonly 
    loc_test.resources.PeKind = ILonly 
    loc_test.resources.PeKind = ILonly 
All input assemblies have a compatible PeKind value. 
Merging assembly 'loc_test' into target assembly. 
Merging assembly 'loc_test.resources' into target assembly. 
Merging assembly 'loc_test.resources' into target assembly. 
Merging assembly-level attributes from assembly 'loc_test' into target assembly. 
Copying 2 Win32 Resources from assembly 'loc_test' into target assembly. 
Transferring entry point 'loc_test.Program.Main' from assembly 'loc_test' to assembly 'loc_test_merged'. 
    There were no errors reported in the target assembly's metadata. 
ILMerge: Writing target assembly 'loc_test_merged.exe'. 
AssemblyResolver: Assembly 'System' is referencing assembly 'System.Configuration'. 
    AssemblyResolver: Attempting referencing assembly's directory. 
Can not find PDB file. Debug info will not be available for assembly 'System.Configuration'. 
Resolved assembly reference 'System.Configuration' to 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll'. (Used referencing Module's directory.) 
Location for referenced assembly 'System.Windows.Forms' is 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll' 
    There were no errors reported in System.Windows.Forms's metadata. 
Location for referenced assembly 'System' is 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll' 
    There were no errors reported in System's metadata. 
Location for referenced assembly 'mscorlib' is 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll' 
    There were no errors reported in mscorlib's metadata. 
Location for referenced assembly 'System.Drawing' is 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll' 
    There were no errors reported in System.Drawing's metadata. 
ILMerge: Done. 

更新:與項目代碼的ZIP文件是可用的http://www.filedropper.com/loctest

更新:相信與否,但如果我在2個步驟執行ILMerge,它的工作原理!

ilmerge /log:loc_test.txt /target:winexe /copyattrs /allowdup /out:loc_test_merged.exe "c:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\loc_test.exe" "C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\fr-FR\loc_test.resources.dll" 

ilmerge /log:loc_test.txt /target:winexe /copyattrs /allowdup /out:loc_test_merged_2.exe loc_test_merged.exe "C:\Users\<user>\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\nl-BE\loc_test.resources.dll" 

這可能是什麼原因?

THX, Janiek

+0

看起來你必須通過該解決方案概述了http://stackoverflow.com/questions希望跳到/ 1952638/single-assembly-multi-language-winforms-deployment-ilmerge-and-satellite-assembl – 2010-12-08 16:11:35

回答

4

雖然我不知道原因的細節,爲什麼ILMerge 2個步驟正確地集成組件,這似乎是目前唯一的解決辦法。檢查我在問題中的最後一次編輯,看看我是如何做到這一點的。

我還是好奇,儘管失敗的原因在1步這樣做......