5

I know there is ILMerge for .NET Framework (Full Framework) assemblies. But what about .NET Core? I would like to create a commandline utility tool, but I don't want it to be like 20 files, but only 1 .exe.

Is there any way to do it?

SuperJMN
  • 13,110
  • 16
  • 86
  • 185
  • 2
    [Feature request, compile dotnet to one self contained executable file #7737](https://github.com/dotnet/cli/issues/7737) – Igor Sep 13 '18 at 19:43
  • Possible duplicate of [ILRepack for .Net Core Projects with MSBuild](https://stackoverflow.com/questions/48169876/ilrepack-for-net-core-projects-with-msbuild) – Richardissimo Sep 13 '18 at 20:21

2 Answers2

2

You can use the new feature of .NET Core 3.0:

dotnet publish -r win10-x64 -p:PublishSingleFile=true

Read on MSDN

nZeus
  • 2,475
  • 22
  • 21
  • 4
    It works only for .EXE. I'm having a hard time looking for something to merge a bunch of assemblies (.NET Standard) into a single one. – Anderson Pimentel Jun 08 '20 at 23:31
  • 8
    It's not the best way as it doesn't work like ILMerge used to. It only compress the files into a single files, but the first time it runs, it'll decompress all the files to a temp folder (%TEMP%\.net in windows) and will run from there. Actually you will see just one file, but it will really create all the files and if for example you need to edit a settings file you have to edit it from that temp folder. – DkAngelito Jun 23 '20 at 13:18
1

Fody ( https://github.com/Fody/Fody ) supports .NET Core since 2017 and you can install it as a NuGet package into your project so it will automatically run as part of your project's build process.

Dai
  • 141,631
  • 28
  • 261
  • 374