ILMerge +本地化资源程序集

我正在使用ILMerge创建一个包含1个exe和2个资源dll的项目中的单个程序集应用程序:

  • BIN 调试 test.exe的
  • BIN 调试 NL-BE test.resources.dll
  • BIN 调试 FR-FR test.resources.dll
  • 这是一个带有1个窗体(Form1.cs)的简单测试项目,所以没什么特别的。 我的目标是创建一个带有工作资源管理器的单个程序集应用程序(我已阅读ILMerge和本地化资源程序集以及单一程序集多语言Windows窗体部署(ILMerge和附属程序集/本地化) - 可能的?有关如何执行的信息这个)。

    编译项目后,我使用以下命令行参数运行ILMerge:

    ilmerge /log:test.txt /target:winexe /copyattrs /allowdup /out:test_merged.exe 
    "C:projectdirbinDebugtest.exe" "C:projectdirbinDebugfr-FRtest.resources.dll" 
    "C:projectdirbinDebugnl-BEtest.resources.dll"
    

    如果我用Reflector检查合并程序集的内容,我会在资源树节点下看到以下内容:

  • 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>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugloc_test.exe C:Users<user>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugfr-FRloc_test.resources.dll C:Users<user>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugnl-BEloc_test.resources.dll 
    Set platform to 'v2', using directory 'C:WindowsMicrosoft.NETFrameworkv2.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>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugloc_test.exe
        C:Users<user>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugfr-FRloc_test.resources.dll
        C:Users<user>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugnl-BEloc_test.resources.dll
    Trying to read assembly from the file 'c:Users<user>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugloc_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>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugfr-FRloc_test.resources.dll'.
    Can not find PDB file. Debug info will not be available for assembly 'C:Users<user>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugfr-FRloc_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>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugnl-BEloc_test.resources.dll'.
    Can not find PDB file. Debug info will not be available for assembly 'C:Users<user>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugnl-BEloc_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:WindowsMicrosoft.NETFrameworkv2.0.50727System.Configuration.dll'. (Used referencing Module's directory.)
    Location for referenced assembly 'System.Windows.Forms' is 'C:WindowsMicrosoft.NETFrameworkv2.0.50727System.Windows.Forms.dll'
        There were no errors reported in  System.Windows.Forms's metadata.
    Location for referenced assembly 'System' is 'C:WindowsMicrosoft.NETFrameworkv2.0.50727System.dll'
        There were no errors reported in  System's metadata.
    Location for referenced assembly 'mscorlib' is 'C:WindowsMicrosoft.NETFrameworkv2.0.50727mscorlib.dll'
        There were no errors reported in  mscorlib's metadata.
    Location for referenced assembly 'System.Drawing' is 'C:WindowsMicrosoft.NETFrameworkv2.0.50727System.Drawing.dll'
        There were no errors reported in  System.Drawing's metadata.
    ILMerge: Done.
    

    更新:http://www.filedropper.com/loctest上提供了带有项目代码的zip文件

    更新:相信与否,但是如果我在2个步骤中执行ILMerge,它就会起作用!

    ilmerge /log:loc_test.txt /target:winexe /copyattrs /allowdup /out:loc_test_merged.exe "c:Users<user>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugloc_test.exe" "C:Users<user>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugfr-FRloc_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>DocumentsVisual Studio 2008Projectsloc_testloc_testbinDebugnl-BEloc_test.resources.dll"
    

    这可能是什么原因?

    Thx,Janiek


    虽然我不知道ILMerge以两个步骤正确地集成程序集的原因,但这似乎是目前唯一的解决方案。 检查我在问题中的最后一次编辑,看看我是如何做到这一点的。

    我仍然好奇,为什么它不能一步完成...

    链接地址: http://www.djcxy.com/p/49213.html

    上一篇: ILMerge + localized resource assemblies

    下一篇: TableAdapter wizard does not have connection string from Settings in pick list