dotnet / dotnet-docker

Docker images for .NET and the .NET Tools.
https://hub.docker.com/_/microsoft-dotnet
MIT License
4.49k stars 1.94k forks source link

A console opens although the OutputType WinExe is set #4659

Open TankB1 opened 1 year ago

TankB1 commented 1 year ago

Describe the Bug

I am using the image mcr.microsoft.com/dotnet/sdk:6.0 to publish a WPF desktop application as a standalone executable. In the .Net project file, the output type is set to WinExe. When I create and launch the application directly on my machine using the dotnet publish command, only the UI of the application launches as expected. If I create the application in the Docker container and start the application on my computer, the UI of the application opens and also a console window, although the output type is set to WinExe.

The behaviour I would expect, as described in the .Net documentation, would be that no console opens in addition to the application UI when the OutputType is set to WinExe.

Steps to Reproduce

Create a WPF-Project with Visual Studio. Configure the publishing profile as following:

\x86\ \bin\Release\net6.0-windows\publish\ \FileSystem\ \<_TargetId>Folder\ \net6.0-windows\ \win-x86\ \true\ \true\ \true\ \True\ \True\

Publish it with a container from the image mcr.microsoft.com/dotnet/sdk:6.0 and the command 'dotnet publish WpfApp1 -c Release /p:PublishProfile=WpfApp1/Properties/PublishProfiles/FolderProfile.pubxml'

Output of docker version

Client: Cloud integration: v1.0.31 Version: 20.10.23 API version: 1.41 Go version: go1.18.10 Git commit: 7155243 Built: Thu Jan 19 17:43:10 2023 OS/Arch: windows/amd64 Context: default Experimental: true

Server: Docker Desktop 4.17.0 (99724) Engine: Version: 20.10.23 API version: 1.41 (minimum version 1.24) Go version: go1.18.10 Git commit: 6051f14 Built: Thu Jan 19 17:37:54 2023 OS/Arch: windows/amd64 Experimental: false

Output of docker info

Client: Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc., v0.10.3) compose: Docker Compose (Docker Inc., v2.15.1) dev: Docker Dev Environments (Docker Inc., v0.1.0) extension: Manages Docker extensions (Docker Inc., v0.2.18) sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0) scan: Docker Scan (Docker Inc., v0.25.0) scout: Command line tool for Docker Scout (Docker Inc., v0.6.0)

Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 20.10.23 Storage Driver: windowsfilter Windows: Logging Driver: json-file Plugins: Volume: local Network: ics internal l2bridge l2tunnel nat null overlay private transparent Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog Swarm: inactive Default Isolation: hyperv Kernel Version: 10.0 19044 (19041.1.amd64fre.vb_release.191206-1406) Operating System: Windows 10 Pro Version 2009 (OS Build 19044.2965) OSType: windows Architecture: x86_64 CPUs: 16 Total Memory: 15.23GiB Name: NBSSC164OS ID: ZGH6:W6IK:BERZ:TWRI:7C6U:2IM4:ITMI:TMO3:G2I7:LDAF:O4LQ:TOVB Docker Root Dir: C:\ProgramData\Docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false Product License: Community Engine

mthalman commented 1 year ago

[Triage]

@dotnet/wpf-developers - Are you aware of any behavior like this?

Our understanding of the scenario can be summarized as follows:

  1. Build a WPF project in a Docker container.
  2. Extract the built exe out of the container.
  3. Run the exe on the local machine.

The expected behavior is that this only opens the application window. The actual behavior is that both the application window and the console window opens.

puschie286 commented 1 year ago

any updates on this ? beside the attribute + icon problem, this is the last thing that keep us from including wpf application in (docker) building pipelines