2010-12-08 67 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步这样做......