2013-09-17 2 views
0

Я разработал свое первое приложение winform в C# на .net 4.0. Скомпилированный вывод имеет файл .exe и .dll. Я проверил, что исполняемый файл работает до слияния. Я объединил эти два файла, используя ILMerge. Я использую ILmerge в первый раз. Поэтому я, должно быть, кое-что допустил, но я не могу решить эту проблему. Я получил один исполняемый файл без каких-либо ошибок. Но после открытия файла результатов он разбивается.Слитый исполняемый сбой

Windows, произвела эти сведения об ошибках на сбой приложения:

Description: 
    Stopped working 

Problem signature: 
    Problem Event Name: CLR20r3 
    Problem Signature 01: mywinapp.exe 
    Problem Signature 02: 1.0.0.0 
    Problem Signature 03: 52383768 
    Problem Signature 04: mscorlib 
    Problem Signature 05: 2.0.0.0 
    Problem Signature 06: 4ca2b851 
    Problem Signature 07: f99 
    Problem Signature 08: 14e 
    Problem Signature 09: System.TypeLoadException 
    OS Version: 6.1.7601.2.1.0.256.1 
    Locale ID: 16393 

Я установил ILMerge и используются следующие команды в CMD от места ILMerge создать объединенный файл с расширением .exe.

ilmerge D:\abc\RemittanceForm.exe D:\abc\PdfFileWriter.dll /out:D:\out\MyWinApp.exe  /target:winexe /ndebug /log:D:\out\aaa.txt 

Содержание файлов журнала выглядит следующим образом:

 
ILMerge version 2.12.803.0 
Copyright (C) Microsoft Corporation 2004-2006. All rights reserved. 
ILMerge D:\abc\RemittanceForm.exe D:\abc\PdfFileWriter.dll /out:D:\out\MyWinApp.exe /target:winexe /ndebug /log:D:\out\aaa.txt 
Set platform to 'v2', using directory 'C:\Windows\Microsoft.NET\Framework64\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: 
    D:\abc\RemittanceForm.exe 
    D:\abc\PdfFileWriter.dll 
Trying to read assembly from the file 'D:\abc\RemittanceForm.exe'. 
    Successfully read in assembly. 
    There were no errors reported in Remittance Form's metadata. 
Trying to read assembly from the file 'D:\abc\PdfFileWriter.dll'. 
    Successfully read in assembly. 
    There were no errors reported in PdfFileWriter's metadata. 
Checking to see that all of the input assemblies have a compatible PeKind. 
    Remittance Form.PeKind = ILonly 
    PdfFileWriter.PeKind = ILonly 
All input assemblies have a compatible PeKind value. 
AssemblyResolver: Assembly 'Remittance Form' is referencing assembly 'System.Windows.Forms'. 
    AssemblyResolver: Attempting referencing assembly's directory. 
    AssemblyResolver: Did not find assembly in referencing assembly's directory. 
    AssemblyResolver: Attempting input directory. 
    AssemblyResolver: Did not find assembly in input directory. 
    AssemblyResolver: Attempting user-supplied directories. 
    AssemblyResolver: No user-supplied directories. 
    AssemblyResolver: Attempting framework directory. 
Resolved assembly reference 'System.Windows.Forms' to 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\..\v2.0.50727\System.Windows.Forms.dll'. (Used framework directory.) 
AssemblyResolver: Assembly 'Remittance Form' is referencing assembly 'System'. 
    AssemblyResolver: Attempting referencing assembly's directory. 
    AssemblyResolver: Did not find assembly in referencing assembly's directory. 
    AssemblyResolver: Attempting input directory. 
    AssemblyResolver: Did not find assembly in input directory. 
    AssemblyResolver: Attempting user-supplied directories. 
    AssemblyResolver: No user-supplied directories. 
    AssemblyResolver: Attempting framework directory. 
Resolved assembly reference 'System' to 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\..\v2.0.50727\System.dll'. (Used framework directory.) 
AssemblyResolver: Assembly 'Remittance Form' is referencing assembly 'System.Drawing'. 
    AssemblyResolver: Attempting referencing assembly's directory. 
    AssemblyResolver: Did not find assembly in referencing assembly's directory. 
    AssemblyResolver: Attempting input directory. 
    AssemblyResolver: Did not find assembly in input directory. 
    AssemblyResolver: Attempting user-supplied directories. 
    AssemblyResolver: No user-supplied directories. 
    AssemblyResolver: Attempting framework directory. 
Resolved assembly reference 'System.Drawing' to 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\..\v2.0.50727\System.Drawing.dll'. (Used framework directory.) 
Using assembly 'Remittance Form' for assembly-level attributes for the target assembly. 
Merging assembly 'Remittance Form' into target assembly. 
Merging assembly 'PdfFileWriter' into target assembly. 
Copying 1 Win32 Resources from assembly 'Remittance Form' into target assembly. 
Transferring entry point 'Remittance_Form.Program.Main' from assembly 'Remittance Form' to assembly 'MyWinApp'. 
    There were no errors reported in the target assembly's metadata. 
ILMerge: Writing target assembly 'D:\out\MyWinApp.exe'. 
AssemblyResolver: Assembly 'System' is referencing assembly 'System.Configuration'. 
    AssemblyResolver: Attempting referencing assembly's directory. 
Resolved assembly reference 'System.Configuration' to 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\System.Configuration.dll'. (Used referencing Module's directory.) 
Location for referenced module 'gdi32.dll' is '' 
Location for referenced module 'Kernel32.dll' is '' 
Location for referenced assembly 'System.Windows.Forms' is 'C:\Windows\Microsoft.NET\Framework64\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\Framework64\v2.0.50727\system.dll' 
    There were no errors reported in System's metadata. 
Location for referenced assembly 'mscorlib' is 'C:\Windows\Microsoft.NET\Framework64\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\Framework64\v2.0.50727\System.Drawing.dll' 
    There were no errors reported in System.Drawing's metadata. 
ILMerge: Done. 

Пожалуйста, помогите мне решить эту проблему.

+0

Смотрите, если этот ответ поможет: http://stackoverflow.com/questions/17222369/how-to- диагностики-система typeloadexception ошибки – NotMe

ответ

0

Я изменил команду ILMerge к следующему:

ilmerge D:\abc\RemittanceForm.exe D:\abc\PdfFileWriter.dll /out:D:\out\MyWinApp.exe /target:winexe /ndebug /log:D:\out\aaa.txt /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" 

Спасибо @Magnus Гриндал Баккен

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