-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not autoreference WindowsBase.dll in Microsoft.NetCore.App #10378
Comments
Though, wonder if this should have been resolved by the SDK. cc @nguerrera @dsplaisted as well. |
Here's what I'd expect to happen. WindowsBase.dll in Microsoft.NETCore.App is autoreferenced. This never causes an issue since this only has type-forwards for a small subset of the real WindowsBase.dll. WindowsBase.dll in Microsoft.WindowsDesktop.App is only referenced when UseWPF is true and takes precedent over the one in Microsoft.NETCore.App. If this isn't happening it sounds like an SDK issue. |
I will look at the repro, I expect things to work as @ericstj describes and at least for several cases that I've debugged in the past, this is what I see. Either something regressed or there's a compounding factor in the repro. |
The repro project is building fine with preview 7, trying preview 6. |
It does repro with preview 6, the difference being that in preview 6 WindowsBase.dll from Microsoft.WindowsDesktop.App was referenced even when UseWPF=true was not set. Starting with preview 7, we won't reference WindowsBase.dll by default without UseWPF=true and you can actually compile code like this repro that redefines the meaning of System.Windows.Point. (Strange, by the way, but it will work.) |
Steps to reproduce
net47
System.Windows
and try to useSystem.Drawing.Point
Like:
Expected behavior
This works just fine.
Actual behavior
This works fine on .NET 47, but not on NETCoreApp3.0 due to
dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0-*\data\FrameworkList.xml
explicitly referencing WindowsBase:In contrast this is the definition for
Microsoft.WindowsDesktop.App
:There is an error thrown while compiling that there is a collision between the alias definition of "Point" and the already existing type "Point" inside WindowsBase.
How are we supposed to port our WinForms applications to .NET Core if this is undermined by the .NET Core project?
I've added a minimal repro solution:
winforms.zip
Environment data
The text was updated successfully, but these errors were encountered: