microsoft / microsoft/microsoft-ui-xaml

ApplicationIcon for WinUI3 Unpackaged version

Open
#10,417 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Icon area-TitleBar
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

Hello,

Why doesn't the parameter `ApplicationIcon` in the .csproj file work as its name suggests with a WinUI3 Unpackaged App ?

MyProj.csproj
```csproj
Assets\icon_name.ico
```

I have to use a small snippet of code to fix this "bug" :
```csharp
private void LoadIcon(string iconName)
{
this.AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, $"Assets/{iconName}.ico"));
}
```

When the LoadIcon function is not called, my application takes the default icon (Win32)

Here’s how it appears on the taskbar:
> ![Image](https://github.com/user-attachments/assets/2b0c92ff-32ad-4d58-8075-515f7b63e7a3)

And here’s how it looks on the window bar:
> ![Image](https://github.com/user-attachments/assets/aad8fddb-3fb7-4743-9401-a97ee606df4a)

Am I doing something wrong or is it a bug ?

Thanks
Quentin

### Steps to reproduce the bug

1/ Set the ApplicationIcon parameter on the XAML file
```csproj
Assets\icon_name.ico
```

2/ Run/Launch the application

Here’s how it appears on the taskbar:
> ![Image](https://github.com/user-attachments/assets/2b0c92ff-32ad-4d58-8075-515f7b63e7a3)

And here’s how it looks on the window bar:
> ![Image](https://github.com/user-attachments/assets/aad8fddb-3fb7-4743-9401-a97ee606df4a)

### Expected behavior

_No response_

### Screenshots

![Image](https://github.com/user-attachments/assets/2b0c92ff-32ad-4d58-8075-515f7b63e7a3)
![Image](https://github.com/user-attachments/assets/aad8fddb-3fb7-4743-9401-a97ee606df4a)

### NuGet package version

Windows App SDK 1.6.3: 1.6.250108002

### Packaging type

Unpackaged

### Windows version

WIN11 10.0.26100.0

### IDE

Visual Studio 2022

### Additional context

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the WinUI 3 unpackaged app with ApplicationIcon set in the .csproj, then compare its behavior with the LoadIcon snippet using AppWindow.SetIcon. Trace how the project setting is handled at launch; done means the configured icon appears on both the taskbar and window bar without the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.