-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Impossible to add UseWindowsForms in a MAUI project #14970
Copy link
Copy link
Closed
Labels
area-single-projectSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, ResizetizerSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizers/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Milestone
Metadata
Metadata
Assignees
Labels
area-single-projectSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, ResizetizerSplash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizers/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackNo fields configured for issues without a type.
I've created a new MAUI project 7.0. In this project I need to reference an assembly compiled against .net 7.0 but with
<UseWindowsForms>true</UseWindowsForms>. So I need to add<UseWindowsForms>true</UseWindowsForms>in the project.When adding this line, the project does not compile anymore and claims for: "Project file must include the .NET Framework assembly 'PresentationCore, PresentationFramework' in the reference list. ... Microsoft.WinFX.targets".
I understand I have to add this line in the MAUI project (not needed in my case):
<UseWPF>true</UseWPF>.Consequently I get this error: 'App' does not contain a definition for 'InitializeComponent'
Tried to force build action to MauiXaml for all XAML files.
if I replace all XAM file by their equivalent cs files, I can add
UseWindowsFormswithoutUseWpfand everything works fine.Seems that when
UseWindowsFormsis added and XAML files exist, WPF is required, even though there is no XAML files for WPF.Visual Studio 17.5.5 has been restarted several times. Bin and Obj directories have been manually deleted several times.