How do I build & deploy a Photino.NET app so it does not display the console when it is ran?

388 views Asked by At

I have read all of the Photino.NET documentation but it doesn't seem to mention how to build a final Release version.

Do you know the dotnet build parameters I need to provide? Or, is there a code change I need to make to the Photino template which will make it so the console window isn't displayed (see example snapshot below) when the final release version runs?

The console window (red highlight) always appears but I just want the main window (green highlight).

two windows for app

What I've Tried

  1. built on Windows 10 stand-alone

    c:\>dotnet publish -r win10-x64 -p:PublishSingleFile=true --self-contained true

  2. built Linux stand-alone app:

    $ dotnet publish -r linux-x64 -p:PublishSingleFile=true --self-contained true

Running Executable Launches (displays) 2 Windows

I ran the subsequent executables that are created from these builds on each of their appropriate systems (Win10, Ubuntu) & they run properly but I always get the console window in the background when they start --

I.E. you get two windows launched 1) console window 2) target app window

Main Question

Is there a way around this in Photino.NET that will only display the target app window?

1

There are 1 answers

0
raddevus On BEST ANSWER

The default .csproj file (created by the Photino project template) contains a section that looks like the following:

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <Platforms>AnyCPU;x64</Platforms>
  </PropertyGroup>

To get this to build as an executable that does not show the Console window output, you have to change the OutputType value to WinExe as shown in the following XML snippet.

<PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <Platforms>AnyCPU;x64</Platforms>
  </PropertyGroup>

After that, if you build using the dotnet build commands that I show in my question then you will get a standalone Exe that runs and does not show the Console window but instead only displays the main app window.

Linux - And, yes, as odd as it seems changing that value to WinExe works on Linux distros also. WinExe is just a "keyword" which seems to mean standalone exe.

Someone provided the answer at the official Photino Github issues list -- you can see that answer here.