Skip to content

Hide console window for self contained .NET Core application

ahopper edited this page Apr 13, 2019 · 9 revisions

Patching executable

To make patching work you first need to publish your .NET Core application using dotnet publish command. The application needs to be published as self contained.

Using NSubsys

By installing the NSubsys NuGet package. The patching is done during application publish.

Install-Package NSubsys


By running the editbin.exe command-line tool. The patching is done after application is published.

editbin.exe /subsystem:windows yourapp.exe

Command-line help

EDITBIN Reference

VS2017 Community editbin paths

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX64\x64
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX64\x86
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86

Note: The path may change after Visual Studio updates.

Using NetCore 3.0

Simply set <OutputType>WinExe</OutputType> in csproj

You can’t perform that action at this time.