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.

5
  • You can click Browse button and select the location where the application should be published and click Next. Commented Aug 3, 2021 at 2:26
  • @Chetan it just changes the location and the output files are still the same. Commented Aug 3, 2021 at 2:34
  • What's the difference are you expecting? Commented Aug 3, 2021 at 2:35
  • I want to publish my project as a single exe, but I can't do that with Console App (.NET Framework) publish window. Commented Aug 3, 2021 at 2: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. Commented Aug 4, 2021 at 6:15

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

5 Comments

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.
If it generates those files, you'll need them, or unexpected behavior might occur. Why do you think you can omit them?
Like I said above your comment, it can be avoided/omit using Console Application publish window.
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?
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.