Skip to content

ApplicationIcon does not work when cross building win-x64 from Linux #3943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NicolasDorier opened this issue Nov 20, 2019 · 15 comments
Open

Comments

@NicolasDorier
Copy link

NicolasDorier commented Nov 20, 2019

How to reproduce

On linux (using Buster 3.0.101):

dotnet new console
# Add myicon.ico to the project
dotnet publish --runtime win-x64 -p:ApplicationIcon=myicon.ico

Grab bin/Debug/netcoreapp3.0/publish/*.exe
Notice that the executable does not show any icon on windows explorer.
The same process on windows works as expected.

Expected

The executable should have the application icon properly set.

Workaround

Post process the .exe with wine and rcedit.exe.
https://github.com/btcpayserver/BTCPayServer.Vault/blob/abf575728b9b1f64bade6cd3a590ed8ac8baf6ee/Build/build.win-x64.Dockerfile#L28

Version

.NET Core SDK (reflecting any global.json):
 Version:   3.0.101
 Commit:    bc5f8df0f5

Runtime Environment:
 OS Name:     debian
 OS Version:  10
 OS Platform: Linux
 RID:         debian.10-x64
 Base Path:   /usr/share/dotnet/sdk/3.0.101/

Host (useful for support):
  Version: 3.0.1
  Commit:  32085cbc72

.NET Core SDKs installed:
  3.0.101 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
@frankracis-work
Copy link

It's not limited to icons. Version information isn't present, either.

No PE resources at all are added to the Win32 EXE file when published on Linux.

Using the "peres" utility from "pev", If built on Linux:
peres -a bin/release/netcoreapp3.1/win-x64/publish/hello.exe
returns
this file has no resources
If built on Windows, the same command will list resources and dump values..

Still present on the latest build: SDK 3.1.200, Host 3.1.2/916b5cba26 on both Linux and Windows.

@KoalaBear84
Copy link

Yes. I found out because I switched to ubuntu for building new releases with GitHub Actions, so switched back to Windows.

Hopefully will be fixed. Building for Windows should remain on Windows unless this is fixed.

@augustocb23
Copy link

Still not working on net5.0. Tested on Ubuntu and Docker (Dotnet SDK image)

@KoalaBear84
Copy link

It would be nice if someone from Microsoft could respond to this about what the reason is and when it will be fixed.

@darkguy2008
Copy link

+1, I just found out this through a Google search because my app built on the cloud in Docker wasn't having an app icon. Is there any timeline from the MS team to fix this?

@eduherminio
Copy link
Member

eduherminio commented Nov 19, 2021

I've identified the same problem cross building win-x64 from macOS (macOS-latest GH runner).
So... no other option but to build from Windows afaik.

@NicolasDorier
Copy link
Author

@eduherminio there is solutions, look at my workaround with wine and rcedit.

@KalleOlaviNiemitalo
Copy link
Contributor

May be a duplicate of dotnet/runtime#3828.

@NicolasDorier
Copy link
Author

How to say it will never be fixed without telling it will never be fixed

image

eduherminio added a commit to lynx-chess/Lynx that referenced this issue Nov 29, 2021
Avoid cross-compiling Linux -> Windows, as a workaround until dotnet/sdk#3943 and dotnet/runtime#3828 are tackled
@keithfin
Copy link

For anyone else that landed on this thread, confirming 6.0.1 is still affected

Southen added a commit to Southen/tcs that referenced this issue Mar 25, 2022
…untime#3828 and dotnet/sdk#3943 are fixed.

Re-wrote bond voucher parsing to use a map with updated credit values, resolves #1
Added caching of previous state for massive performance gains (AppData json).
Added detection when not run from command line to wait for input before closing.
@MaverickMartyn
Copy link

MaverickMartyn commented Apr 22, 2022

@NicolasDorier According to dotnet/runtime#3828 this is scheduled for 7.0.0 again.
No need to assume anything. It was likely just moved to "Future" temporarily as it was being investigated. :)

@markusschaber
Copy link

@NicolasDorier According to dotnet/runtime#3828 this is scheduled for 7.0.0 again. No need to assume anything. It was likely just moved to "Future" temporarily as it was being investigated. :)

I can confirm that 7.0 is still affected. :-(

@NicolasDorier
Copy link
Author

NicolasDorier commented Oct 29, 2023

I believe 8.0 now fixed it and this can be closed (dotnet/core#8439 (comment)), didn't try yet though.

@downthecrop
Copy link

downthecrop commented Nov 5, 2023

I believe 8.0 now fixed it and this can be closed (dotnet/core#8439 (comment)), didn't try yet though.

Was able to test my pipeline with mcr.microsoft.com/dotnet/sdk:8.0 RC docker image. Successfully cross compiled with the ico! 💯

@markusschaber
Copy link

Seems to work on my side with .NET 8 SDK, the fix might have been dotnet/runtime#3828.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests