question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Console Window shown when running GUI on Windows, (0.10.7)

See original GitHub issue

When running GUI application on Windows, a Console window is also shown.

I am aware of previous issue which seems to have been (partially) resolved:

https://github.com/AvaloniaUI/Avalonia/issues/1705

However, AND FULL DISCLOSURE, what I am doing is building the application on LINUX and then running the output binary on Windows. If, however, I build AND run the app on Windows, the console window does not appear as expected.

However, it should be possible to build on one system and run on another correctly as .NET 5 offers this.

To Reproduce Here is my csproj:

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<OutputType>WinExe</OutputType>
		<TargetFramework>net5.0</TargetFramework>
		<Nullable>enable</Nullable>
		<ApplicationIcon>Assets/app.ico</ApplicationIcon>
	</PropertyGroup>
	<ItemGroup>
		<AvaloniaResource Include="Assets\**"/>
	</ItemGroup>
	<ItemGroup>
		<PackageReference Include="Avalonia" Version="0.10.7"/>
		<PackageReference Include="Avalonia.Desktop" Version="0.10.7"/>
		<PackageReference Include="Avalonia.Diagnostics" Version="0.10.7"/>
	</ItemGroup>
</Project>

Here is the publish command, called on Linux:

dotnet publish -r win-x64 -c Release --self-contained true -p:DebugType=None -p:DebugSymbols=false -o "AppImages/AppDir"

Expected behavior A console window in addition to min GUI window should not appear.

Screenshots

dos_win

Desktop (please complete the following information):

  • OS: Windows 10 (built on Fedora 34)
  • Version 0.10.7

Additional context Adding NSubsys package reference (as suggested elsewhere in link above) has no effect.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kekekekscommented, Nov 8, 2021

I guess for now one could copy-paste the relevant source code from NSubsys and run it as a separate console app during the build process.

1reaction
grokyscommented, Nov 8, 2021

This looks to me like a problem with the .NET SDK. Most likely MS haven’t encountered it because they don’t have a cross-platform UI framework, I’d advise opening an issue at https://github.com/dotnet/sdk/issues

Read more comments on GitHub >

github_iconTop Results From Across the Web

Console opens when running GUI C++ application
And select "Windows (/SUBSYSTEM:WINDOWS)" for SubSystem. Share.
Read more >
Windows Console Window - Development
Hello, when Syncthing is started it automatically opens a console window on Windows. The problem isn't new, here the solution.
Read more >
Visual Studio 2019 desktop GUI application how to get ...
The GUI is a little window with a button in it. When you click the button, the couts show which classes the event...
Read more >
How to Hide Console Window for GUI apps on Windows 11?
Make a .bat file to run the app. Make a shortcut to the .bat file. Open the shortcut the Properties. Set Run to...
Read more >
Using KvarQ Graphical User Interface (GUI)
The right pane in the main window shows the log output that describes the general activity as well as useful additional information during...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found