Avatar ·

How to embed DLL libraries into a compiled C# EXE file?

Hello everyone! I'm writing a small C# application (Windows Forms) that uses a third-party library — for example, Newtonsoft.Json or iTextSharp. When I build the project in Visual Studio, my .exe file and a bunch of .dll files appear in the Debug/Release folder. This is inconvenient for users: they need to ensure all libraries are located next to the exe file, otherwise the program won't run. I want to make it so that all DLLs are embedded directly inside a single .exe file. That is, the user gets one file, runs it, and everything works without any additional steps. I tried googling and came across ILMerge, but it's outdated and doesn't support .NET Core / .NET 5+. I also heard about Costura.Fody, but I'm not sure how to configure it properly. Is there a modern way to do this in .NET 6/7/8? Or m