Windows NetCore GUI wont stop opening a goddamn console window and unix is at fault

Posted by Programming Is Moe on Monday, November 9, 2020

TOC

“NetCore builds work cross platform without any issues.” And other lies you tell yourself before going to sleep.

NetCore is by now the best experience I’ve ever had with cross platform development but that has only been as long as stayed on the web development side of things. In web development I’m able to develop on my windows machine, push the code to an alpine build server that creates an alpine docker image to run on a linux docker host. Work on windows, build on linux and run on linux.

But with GUI development I foolishly thought: develop on windows, build on linux and run on windows, would work.

And the saddest part is I haven’t actually yet started on working on the actual cross platform implementation of my application yet. Yay.

My windows exe will always open a console window in addition to the GUI

So what gives?

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>WinExe</OutputType>
        <TargetFramework>netcoreapp3.1</TargetFramework>
    </PropertyGroup>
</Project>

the WinExe outputType is supposed to cause the exe to be a special windows exe that does NOT open a console…. Oh wait. something something “Special windows”.

Yeah that’s the issue. Any dotnet build run on a linux distro just cannot append the windows special markers on the exe if I understood right. Trail that lead me to that conclusion was: