Локализованные сборки ресурсов ILMerge +

Я использую ILMerge для создания единого сборочного приложения из проекта, содержащего 1 exe и 2 ресурсных dll:

  • \ bin \ Debug \ test .exe
  • \ bin \ Debug \ nl-BE \ test.resources.dll
  • \ bin \ Debug \ fr-FR \ test.resources.dll

Это простой тестовый проект с 1 формой (Form1. cs), так что ничего особенного. Моя цель - создать приложение с одной сборкой с работающим диспетчером ресурсов (я прочитал ILMerge и локализованные сборки ресурсов и многоязычное развертывание Windows Forms с одной сборкой (ILMerge и вспомогательные сборки / локализация) - возможно? для информации о том, как это сделать).

После компиляции проекта я запускаю 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"

Если я проверю содержимое объединенной сборки с помощью Reflector, я см. следующее под узлом дерева ресурсов:

  • test.Form1.fr-FR.resources
  • test.Form1.fr-FR.resources
  • test.Form1.resources
  • test.Properties.Resources. ресурсы

Вместо ресурсов fr-FR и nl-BE у меня в 2 раза больше ресурсов fr-FR. Это потому, что ресурс dll ' s имеют одинаковые имена? В результате я могу получить ресурсы 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\\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\loc_test.exe C:\Users\\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\fr-FR\loc_test.resources.dll C:\Users\\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\\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\loc_test.exe
    C:\Users\\Documents\Visual Studio 2008\Projects\loc_test\loc_test\bin\Debug\fr-FR\loc_test.resources.dll
    C:\Users\\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\\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\\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\\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\\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\\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 в два этапа, это сработает!

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

В чем может быть причина этого?

Thx, Яник

7
задан Community 23 May 2017 в 12:34
поделиться