How can I deploy a C # console application as a single exe?

I searched for this, and there are a number of previous answers, but they all seem too complicated.

I am new to C # and Windows development in general (previous Mac developer).

I wrote a simple console application in C # using the version of Visual Studio Community. My application uses two third-party libraries (CommandLineParser and json.NET) added to my project using NuGet from VS.

All I want to do is build my project as a standalone .exe file that you can simply run from the command line without worrying about the end user having to install a lot of DLLs (something that I don’t use to deal with a new user Windows). I understand that the end user must have the .NET platform installed. Is there any idiotic proof of a guide for creating a single .exe file in my use case?

I cannot help but think that this should be a very common problem.

Thanks.

+6
source share
2 answers

Alternatively, if you want to run the adhoc test to see that it really works and do it relatively quickly, you can try using the ILMerge interface

I previously tried using ILMerge on my own. With a graphical interface, it was much faster for me to verify that I can make everything work.

+4
source

You can combine the libraries with ILMerge and fire it as a post build event in Visual Studio. This will create one exe with all libraries. You will find more information about ILMerge here .

+5
source

Source: https://habr.com/ru/post/1012244/


All Articles