0

For some reason my console application, using .NET 5, Visual Studio Community 2019 Version 16.11.2, builds and runs as a windows application.

In the csproj file it is set as <OutputType>Exe</OutputType> but in the "Application" page of the project properties GUI it shows as a "windows application" and changing it has no effect. When debugging or running it no console window is displayed.

How can I fix this?

Tessaract
  • 1,047
  • 7
  • 24
  • The rest of the .csproj file matters as well. When you have UseWPF or UseWindowsForms then you'll always get a WinExe, regardless of the OutputType. Manually add `true` to fix. – Hans Passant Oct 29 '21 at 15:02
  • @HansPassant, oh, yeah I do have WPF and WinForms enabled, was using them for the Clipboard class. I'm fairly certain I could run a console app with them enabled before, though. – Tessaract Oct 29 '21 at 15:05
  • 1
    Its fine, just yet another annoying quirk about SDK-style projects. We'll have to start calling them "bugs". – Hans Passant Oct 29 '21 at 15:09
  • From your question,why not create a Windows Form project. Then: Project Properties -> Application -> Output Type -> Console Application [How do I show a console output/window in a forms application?.](https://stackoverflow.com/questions/4362111/how-do-i-show-a-console-output-window-in-a-forms-application) Does this help? – Jiale Xue - MSFT Nov 01 '21 at 02:20

0 Answers0