How to decrease the output of a .net core 2.2 console app

I needed to write a console app the other day and wanted to use .net core console app for the first time. I’ve finished the coding and tested in my computer. Than when I want to publish the application to the server as a windows service. I’ve realised that the output has 241 files like below

As you can see a lot of files for a really small application. So I’ve dug a little and found a package to trim the output. It’s called Microsoft.Packaging.Tools.Trimming.

I’ve installed it and add Trim Unused Dependencies tag to the csproj file.

Build the project after adding this tag and publish again. Now there are 110 files in the output. This is still a lot of files. But it is enough for me.

I’ll share more like this.


Leave a Reply

Your email address will not be published. Required fields are marked *