-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
My WPF application (https://github.com/aiqinxuancai/Aria2Fast) has been working flawlessly since its initial upgrade from .NET 6 to .NET 9. Typically, I only need to modify the TargetFramework to complete the upgrade. However, a few days ago when I upgraded it to(VS2026) to .NET 10 and ran it after publishing, it threw the error: "Could not load file or assembly 'System.Drawing.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'."
I can reproduce this issue locally. When I downgrade back to .NET 9, the problem resolves immediately.
Strangely, this error doesn't appear during debugging. I'm not sure if the .NET 10 release trimmed the library issues.
Reproduction Steps
First, change the project's TargetFramework to "net10.0-windows". Then, use the following configuration for publishing to reproduce the issue.
<?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\Release\net10.0-windows\publish\win-x64\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net10.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>
Expected behavior
The executable file runs normally after being published.
Actual behavior
First perform the publish, then run the published exe file, and it prompts an error "Could not load file or assembly 'System.Drawing.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'."
Regression?
Can be normally published and run before .Net10
Known Workarounds
Roll back to .Net 9 to publish the exe.
Impact
No response
Configuration
No response
Other information
No response