Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide console/terminal #80

Open
codec-abc opened this issue Nov 11, 2018 · 4 comments
Open

Hide console/terminal #80

codec-abc opened this issue Nov 11, 2018 · 4 comments

Comments

@codec-abc
Copy link

Hi,
This is again a newbie question:

All tests I did on Windows had a console window that was around since the .Net Core project was a console one. While useful for debugging and such, this isn't something I want for release. Is there a way to not show (or hide) the terminal window?

@pauldotknopf
Copy link
Member

On Windows, there two ways to compile an app. You can compile as a "Windows Application" or a "Console Application".

GUI apps (WinForms, WPF) are typically compiled as a "Windows Application".

.NET Core currently doesn't support a way to compile in any other way than "Console Application", but there is a post-build step to achieve the same effect (since it's just a flag in the compiled exec).

Run this on your deployed app.

editbin.exe /subsystem:windows yourapp.exe

See here for more info.

Since .NET Core 3.0 will support WinForms and WPF, it will have the option of compiling as a "Windows Application", but until then, we need this post-build step.

@codec-abc
Copy link
Author

Thanks for the answer. By curiosity, how the program behave on Linux/Mac?

@pauldotknopf
Copy link
Member

The binaries behave as you'd expect on Linux/Mac. It is only Windows that has this concept of "Windows application" vs "Console application".

@vadi2
Copy link
Contributor

vadi2 commented Jun 26, 2019

As of .NET Core 3.0, you can set <OutputType>WinExe</OutputType> in your csproj or pass /p:OutputType=WinExe as an argument to dotnet publish to avoid the console window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants