2

In Console Application, the publish window is looks like this. enter image description here

However, in Console App (.NET Framework), the publish is like this. enter image description here

My project is in C# Console App (.NET Framework) and I want to publish as "Folder". How can I do that? Console Application doesn't support Framework 4.7.2 so I'm using Console App (.NET Framework).

Edited: I want to publish my project as a single exe but I can't do it using the Console App (.NET Framework) publish window. It generates .application, .config, .manifest files.

  • You can click `Browse` button and select the location where the application should be published and click Next. – Chetan Aug 03 '21 at 02:26
  • @Chetan it just changes the location and the output files are still the same. – Brian Antiqueña Aug 03 '21 at 02:34
  • What's the difference are you expecting? – Chetan Aug 03 '21 at 02:35
  • I want to publish my project as a single exe, but I can't do that with Console App (.NET Framework) publish window. – Brian Antiqueña Aug 03 '21 at 02:46
  • 1
    @Brian Antiqueña, based on my research, Console App(.NET Framework) doesn't support for generating a single exe for Visual studio Functions. If you indeed, you could request a feature in [Developer Community](https://developercommunity.visualstudio.com/home). – Jack J Jun Aug 04 '21 at 06:15

1 Answers1

1

That's not possible with .NET Framework. There are (external) tools, such as ILMerge that can do this trick, but with .NET framework out of itself, this feature is not available. Check this topic: How do I merge multiple .net assemblies into a single assembly?. Alternatively, you could change to .NET 5.0 to get that feature.

PMF
  • 14,535
  • 3
  • 23
  • 49
  • I'm not planning to merge multiple assemblies into one, I just want my main C# console project to generate one exe when publishing and it's fine if it generate dlls. My problem is whenever I'm publishing with Console App (.NET Framework) publish window, it also generates .application, .config, .manifest files which can be avoided using Console Application publish window. – Brian Antiqueña Aug 03 '21 at 07:32
  • If it generates those files, you'll need them, or unexpected behavior might occur. Why do you think you can omit them? – PMF Aug 03 '21 at 16:13
  • Like I said above your comment, it can be avoided/omit using Console Application publish window. – Brian Antiqueña Aug 03 '21 at 23:58
  • Then maybe I missunderstood your question. Can you be a bit more specific on how you get to the two different cases you mention above? Not because the two projects target different runtimes? – PMF Aug 04 '21 at 11:02
  • Console Application uses .NET Core while the other one uses .NET Framework. I've tried ILMerge in your answer and it might be a better alternative answer than the one I was looking for. Thanks – Brian Antiqueña Aug 04 '21 at 23:50