Чтобы объединить не все DLL с ILMerge - PullRequest
0 голосов
/ 12 ноября 2018

Возможно ли объединить не все, а только некоторые из справочных dll с ILMerge?У меня есть две ссылки - Zxsign и DirectShowLib.Я сделал ILMerge только с DirectShowLib:

"C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe" SnapShot.exe DirectShowLib.dll /out:aa.exe

ФАЙЛОВ zxing.dll и zxing.presentation.dll был помещен рядом с aa.exe.Получено исключение при вызове пакета zxing:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.Exception: Timeout waiting to get picture
       at SnapShot.Capture.Click()
       at SnapShot.Form1.button1_Click(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.8936 (WinRelRS4.050727-8900)
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
    ----------------------------------------
    aa
        Assembly Version: 1.0.6890.24360
        Win32 Version: 1.0.6890.24360
        CodeBase: file:///D:/C%23nonsens/DirectShowSamples-2010-February/Samples/Capture/DxSnap/bin/Release/New%20folder/aa.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.8922 (WinRelRS4.050727-8900)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.8934 (WinRelRS4.050727-8900)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.8922 (WinRelRS4.050727-8900)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.

Можно ли как-то управлять ILMerge, чтобы не было такой ошибки?

1 Ответ

0 голосов
/ 12 ноября 2018

Это возможно с помощью следующего nuget Install-package ILMerge.MSBuild.Tasks

Пример цели в .csproj между <Project> </Project>

<Target Name="AfterBuild">
  <ItemGroup>
    <MergeAsm Include="$(OutputPath)$(AssemblyName).dll" />
    <MergeAsm Include="$(OutputPath)2nd.dll" />
    <MergeAsm Include="$(OutputPath)3th.dll" />
  </ItemGroup>
  <PropertyGroup>
    <MergedAssembly>$(ProjectDir)$(OutDir)$(AssemblyName).dll</MergedAssembly>
  </PropertyGroup>
  <Message Text="ILMerge @(MergeAsm) -&gt; $(MergedAssembly)" Importance="high" />
  <ILMerge InputAssemblies="@(MergeAsm)" OutputFile="$(MergedAssembly)" TargetKind="SameAsPrimaryAssembly" />
</Target>

MergeAsm, который вы можете определить каждый dll, который вы хотите объединить с основным, как показано в примере 2nd.dll и 3th.dll

...