0

I have a solution with two C# projects: One WinForms application (exe) and one library (dll). Multiple external dll files are referenced. I would like to merge the output of my projects into one exe file, while keeping the other dll files separately, i.e. instead of

  • myApp.exe
  • myLib.dll
  • externalLib1.dll
  • externalLib2.dll
  • ...

I would like to have

  • myMergedAppAndLib.exe
  • externalLib1.dll
  • externalLib2.dll
  • ...

Is this actually possible? I am aware of the ILMerge tool, but it seems to be deprecated and I don't know whether it is ok not to include all referenced dll files. I am also aware of the publishing option in Visual Studio Produce single file, but to my understanding this will also merge the external dll files, right?

I cannot merge the two projects, because the library project is also used for a third project (another WinForms exe).

Related SO question: merge-dll-into-exe

Thomas853
  • 517
  • 1
  • 7
  • 12
  • 1
    ILMerge was never something i would call official it might be no longer maintained but should atleast work for all pre core frameworks. Changing myLib into a [Shared project](https://learn.microsoft.com/en-us/xamarin/cross-platform/app-fundamentals/shared-projects?tabs=windows) might be an option for you. – Ralf Jan 26 '23 at 11:45
  • Thanks, @Ralf! I think the Shared Project approach is the way to go! I was not aware of this kind of project. – Thomas853 Jan 26 '23 at 11:52
  • Apparently, Shared Projects do not support the WinForms designer, i.e. I cannot use it. Source: https://learn.microsoft.com/en-us/answers/questions/306210/winforms-in-shared-projects-designer-doesnt-work – Thomas853 Jan 26 '23 at 19:41

0 Answers0