ILMerge + localized resource assemblies
I'm using ILMerge to create a single assembly application out of a project that contains 1 exe and 2 resource dll's:
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).
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:projectdirbinDebugtest.exe" "C:projectdirbinDebugfr-FRtest.resources.dll"
"C:projectdirbinDebugnl-BEtest.resources.dll"
If I check the contents of the merged assembly with Reflector, I see the following under the resource tree node:
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.
Any ideas ?
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>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.
Update: A zip file with the project code is available on http://www.filedropper.com/loctest
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>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"
What could be the reason for this ?
Thx, Janiek
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.
I'm still curious though why it fails to do so in 1 step...
链接地址: http://www.djcxy.com/p/49214.html上一篇: Java中的样条曲线
下一篇: ILMerge +本地化资源程序集