stride3d / stride

Stride Game Engine (formerly Xenko)
https://stride3d.net
MIT License
6.32k stars 917 forks source link

PublishSingleFile removes icon #2304

Closed YerkoAndrei closed 2 days ago

YerkoAndrei commented 3 weeks ago

Release Type: Official Release

Version: 4.2.0.2149

Platform(s): Windows

Describe the bug When publishing a game with <PublishSingleFile>true</PublishSingleFile> the icon does not appear in the title bar nor the task bar of Windows.

To Reproduce Steps to reproduce the behavior:

  1. Create project
  2. Create Publish profile with PublishSingleFile set to true
  3. Publish and play

Expected behavior The default icon should me visible in the title bar and the task bar.

Screenshots imagen

Additional context The build works as expected, except for the icon. The build works as expected when PublishSingleFile is set to false. The .exe shows the icon as expected. Changing the icon does nothing. Seting the .ico as resource and/or including it in the publish folder does nothing.

This a simple publish profile:

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
  <PropertyGroup>
    <Configuration>Release</Configuration>
    <Platform>Any CPU</Platform>
    <PublishDir>..\Bin\Windows\Publish\</PublishDir>
    <PublishProtocol>FileSystem</PublishProtocol>
    <_TargetId>Folder</_TargetId>
    <TargetFramework>net8.0-windows</TargetFramework>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <SelfContained>false</SelfContained>
    <PublishSingleFile>true</PublishSingleFile>
    <PublishReadyToRun>false</PublishReadyToRun>
  </PropertyGroup>
</Project>
Kryptos-FR commented 3 weeks ago

Did you try setting the <Application icon> property on the project file?

edit: never mind, it's set by default in the game template.

It does feel like a .NET issue, not a Stride specific one.

YerkoAndrei commented 3 weeks ago

idk if its relevant but in a .NET 8 WPF build it doesnt happen

MeharDT commented 3 weeks ago

Workaround: publish with SDL, the bug seems exclusive to Windows Forms builds.

You can do this by opening the App.cs file in your Windows project and changing game.Run(); to game.Run(GameContextFactory.NewGameContextSDL());

YerkoAndrei commented 3 weeks ago

Fullscreen doesnt work on SDL (but the icons show hehe) I got this when changing to fullscreen:

Stride.Graphics.GraphicsException: 'Unexpected error on Present (device status: Normal)'

SharpDXException: HRESULT: [0x887A0001], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_INVALID_CALL/InvalidCall], Message: La aplicación realizó una llamada no válida. Los parámetros de la llamada o el estado de algún objeto no eran correctos.
Habilite la capa de depuración D3D para conocer los detalles mediante mensajes de depuración.
MeharDT commented 3 weeks ago

Ah that's right, I forgot about that. I believe the SDL fullscreen bug is being tackled here,

https://github.com/stride3d/stride/issues/2008