wpf throw Could not load file or assembly 'System.Windows.Forms exception on starting if published with --self-contained #10108
Labels
Investigate
Requires further investigation by the WPF team.
Description
When I run the wpf application it throw
Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
if any third party need System.Windows.Forms when I publish the application using --self-contained and works fine if --self-contained=false
Reproduction Steps
Create a new wpf project and references it for example Microsoft.AppCenter which requires System.Windows.Forms
configure the AppCenter on startup
Expected behavior
To run normally like self-contained=false publishing
Actual behavior
It throws exception
Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
Regression?
It works if I publish the using self-contained=false
Known Workarounds
No response
Impact
No response
Configuration
dotnet 9
windows 11
x64
Other information
WpfApp9-master.zip
The text was updated successfully, but these errors were encountered: