2010-12-08 3 views
7

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

  • \ Bin \ Debug \ test.exe
  • \ Bin \ Debug \ п-BE \ test.resources.dll
  • \ Bin \ Debug \ FR-FR \ test.resources.dll

Это простой тестовый проект с 1 формой (Form1.cs), поэтому ничего особенного. Моя цель - создать одно приложение для сборки с рабочим менеджером ресурсов (я прочитал ILMerge and localized resource assemblies и Single-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 и п-ВЕ ресурсов у меня 2 раза FR-FR ресурсов. Это потому, что у dll ресурса одинаковые имена? В результате я могу получить ресурсы fr-FR во время выполнения.

Любые идеи?

Update (журнал содержимое файла): (Примечание: Бинарные начинаются с «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. 

Обновление: почтовый файл с кодом проекта доступно на http://www.filedropper.com/loctest

Обновление: Верьте или нет, но если я выполню ILMerge за 2 шага, он работает!

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-assembly – 2010-12-08 16:11:35

ответ

4

Пока я не знаю подробностей о причине, почему ILMerge интегрирует узлы правильно в 2 этапа, это, кажется, единственным решением на данный момент. Проверьте мое последнее изменение в вопросе, чтобы узнать, как я это сделал.

Я до сих пор интересно, хотя, почему он не в состоянии сделать это в 1 шаг ...

 Смежные вопросы

  • Нет связанных вопросов^_^