`PublishAot` deployment ignores call to `Application.SetHighDpiMode`
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
Description
### .NET version
.NET SDK:
Version: 9.0.100-preview.5.24307.3
Commit: 35b2c21ea6
Workload version: 9.0.100-manifests.6407b7e4
MSBuild version: 17.11.0-preview-24279-02+b963c24ef
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Microsoft.WindowsDesktop.App 9.0.0-preview.5.24306.8
### Did it work in any of the earlier releases of .NET Core or .NET 5+?
_No response_
### Issue description
`dotnet publish`

`dotnet run` or publish with `` in manifest

but specifying dpi awareness in manifest results in warning `CSC : warning WFAC010: Remove high DPI settings from C:\Source\ttt\app.manifest and configure via Application.SetHighDpiMode API or 'ApplicationHighDpiMode' project property`
Display settings

### Steps to reproduce
`mkdir ttt && cd ttt && dotnet new winforms`
Form1.cs
```cs
namespace ttt;
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
var cb = new CheckBox();
cb.Location = new Point(3, 73);
cb.Size = new Size(152, 29);
cb.Text = "Always on top";
cb.UseVisualStyleBackColor = true;
Controls.Add(cb);
}
}
```
ttt.csproj
```csproj
WinExe
net9.0-windows
enable
true
enable
true
<_SuppressWinFormsTrimError>true
```
app.manifest
```xml
true
```
Contributor guide
Assessment
This issue has not been assessed yet.