ILMerge +本地化的资源组件 [英] ILMerge + localized resource assemblies

查看:209
本文介绍了ILMerge +本地化的资源组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ILMerge到了一个包含1 .exe和2资源DLL的一个项目创建一个单独的组件,应用程序:

I'm using ILMerge to create a single assembly application out of a project that contains 1 exe and 2 resource dll's:


  • \\ \\bin\Debug\test.exe

  • \bin\Debug\\\
    l-BE\test.resources.dll

  • \bin\Debug\fr-FR\test.resources.dll

这是一个与1组成一个简单的测试项目( Form1.cs的),所以没有什么特别的。
我的目标是创建一个工作资源管理器的单一组件的应用程序(我已阅读 ILMerge和本地化资源组件单装配多语言的Windows窗体部署(ILMerge和卫星组件/本地化) - ?可能,获取有关如何做到这一点)信息

It's a simple test project with 1 form (Form1.cs), so nothing special. My goal is to create a single assembly app with a working resource manager (I have read ILMerge and localized resource assemblies and Single-assembly multi-language Windows Forms deployment (ILMerge and satellite assemblies / localization) - possible? for info on how to do this).

编译项目后我跑iLMerge使用以下命令行参数:

After compiling the project, I run ILMerge with the following command-line parameters:

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"

如果我请与反射合并后的程序集的内容,我看到了资源树节点下以下内容:

If I check the contents of the merged assembly with Reflector, I see the following under the resource tree node:


  • test.Form1.fr-FR.resources

  • test.Form1.fr-FR.resources

  • test.Form1。资源

  • test.Properties.Resources.resources

  • 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资源。

Instead of the fr-FR and nl-BE resources I have 2 times the fr-FR resources. Is this because the resource dll's have the same names ? The result is that I can only get the fr-FR resources at runtime.

任何想法?

更​​新(日志文件内容):
(注:二进制文件与loc_为前缀,我给他们留下了我在以前的帖子为清楚起见)

Update (log file contents): (Note: Binaries are prefixed with "loc_", I left them out in my previous posting for clarity)

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

更新:信不信由你,但如果我执行在ILMerge 2个步骤,它的工作原理

Update: Believe it or not, but if I perform the ILMerge in 2 steps, it works !

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

Thx, Janiek

推荐答案

虽然我不知道原因的细节,为什么ILMerge 2个步骤正确地集成组件,这似乎是目前唯一的解决办法。检查我上次编辑的问题,看我是如何做到这一点。

While I don't know the details on the reason why ILMerge integrates the assemblies correctly in 2 steps, this seems to be the only solution at the moment. Check my last edit in the question to see how I did this.

我还是好奇,尽管失败的原因在1步这样做...

I'm still curious though why it fails to do so in 1 step...

这篇关于ILMerge +本地化的资源组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆