Hello fellow devs.
I’m facing a small hurdle and hoped to get some advice from you.
Here’s the setup :
Monogame 3.8 
DesktopGL 
.net core 6 
self contained publishing, from Linux 
 
Things are working fine on Linux and Windows, it’s almost  perfect.
However, I noticed that when running the build result under Windows, the game is launched with a command console , and that’s not what i want.
In order to solve that, I published the game from Windows, and it works as expected, no console displayed.
I’m not very keen on having to  boot on Windows in order to publish my game, so I was wondering if there were a better and easiest way to proceed.
Thanks in advance.
Edit : clarifying
             
            
               
               
               
            
            
                 
                 
              
           
          
            
            
              Check your csproj, you should change the output type to WinExe:
<OutputType>WinExe</OutputType>
 
             
            
               
               
               
            
            
                 
                 
              
           
          
            
            
              Thanks for your answer. 
It’s already the case.
As I stated, publishing for Win from Win gives the expected result, where publishing for Win from Linux, leads to a console window displayed.
As a matter of fact, I tested the official monogame cornflower blue template, .net3.1 and the results are the same.
             
            
               
               
               
            
            
                 
                 
              
           
          
            
            
              In that case you’re running into
  
  
    
  
  
    
    
      
        opened 07:07PM - 05 Apr 20 UTC 
      
        
          closed 08:16PM - 07 Apr 20 UTC 
        
      
     
   
 
  Why dotnet publish -r win-x64 -c release /p:PublishSingleFile=true produce different exe files on Windows and macOS?
It is strange that behavior of...
 
    untriaged 
   
  
    
    
  
  
 
It will be fixed in .NET 7 apparently:
  
  
    
  
  
    
    
      
        opened 08:55PM - 04 Nov 19 UTC 
      
      
     
   
 
  On dotnet/core-setup#6831, it was noted that there now exists some portable code somewhere to update win32 resources, but we are still...
 
    area-HostModel 
   
  
    
    
  
  
 
             
            
               
               
              2 Likes 
            
            
                 
                 
              
           
          
            
            
              Thanks for tracking this down  
Indeed I was sure it was a dotnet issue, but i was expecting someone to have a workaround.
Looks like I’ll have to publish using windows until then.
             
            
               
               
              1 Like 
            
            
                 
                 
              
           
          
            
            
              One reason I didn’t notice this before was that I release my games on itch.io  and I launch them through the itch launcher. Apparently the launcher does something because the consoles don’t show.
There might be another workaround using rcedit . You can see this dirty hack I did here to add an icon to my app under Linux:
Maybe there’s an option to also hide the console with rcedit. https://github.com/electron/rcedit 
             
            
               
               
              2 Likes