Microsoft.Toolkit.Win32 icon indicating copy to clipboard operation
Microsoft.Toolkit.Win32 copied to clipboard

Microsoft.Toolkit.Wpf.UI.Controls incompatible with .Net 5.0

Open matthew25187 opened this issue 4 years ago • 28 comments

Describe the bug

If I try to compile a .Net 5.0 WPF application that includes the Microsoft.Toolkit.Wpf.UI.Controls package, I get the following error: NETSDK1135 SupportedOSPlatformVersion 10.0.18362.0 cannot be higher than TargetPlatformVersion 7.0. WpfApp1 C:\Program Files\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 185

  • [ ] Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a new project based on the WPF App (.NET) template.
  2. Add to the project the Microsoft.Toolkit.Wpf.UI.Controls NuGet package.
  3. Compile the solution.
  4. See error

Expected behavior

I should be able to successfully compile a .Net 5.0 project that includes the Microsoft.Toolkit.Wpf.UI.Controls package.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

NuGet Package(s): 
Microsoft.Toolkit.Wpf.UI.Controls

Package Version(s): 
6.1.2

Project .NET Version:
- [ ] .NET Framework (version: )
- [ ] .NET Core 3
- [ ] .NET Core 3.1 Preview (version: )

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)

Device form factor:
- [X] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [X] 2019 (version: 16.8.0) 
- [ ] 2019 Preview (version: )

Additional context

Add any other context about the problem here.

matthew25187 avatar Nov 26 '20 00:11 matthew25187

Hello matthew25187, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

ghost avatar Nov 26 '20 00:11 ghost

Adding SupportedOSPlatformVersion 7.0 into your csproj file as message will remove this error. <SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>

But, it will show another error message that you should use cswinrt to use WinRT API in .NET 5

pcfulife avatar Dec 06 '20 07:12 pcfulife

Same issue here.

r-work avatar Dec 08 '20 10:12 r-work

Same on Winforms

JensNordenbro avatar Dec 08 '20 16:12 JensNordenbro

Why is this issue closed? I don't use WebView2. I need MapControl.

nesherhh avatar Jan 20 '21 04:01 nesherhh

I honestly don't understand why this was closed either. I encountered this issue while using the InkCanvas and InkToolbar.

I was hoping to test out XAML Islands alongside the Windows 10 APIs being easily accessible when using .NET 5 at the same time.

JaykeBird avatar Jan 20 '21 04:01 JaykeBird

@nesherhh @JaykeBird sorry, I misread and didn't realize this was for the root package and not the WebView package and triaged incorrectly. I've re-opened the issue.

FYI @marb2000 @ocalvo.

michael-hawker avatar Jan 20 '21 08:01 michael-hawker

I have the same issue. I have a large WPF app that I have been migrating to .NET 5. The migration is now complete. This morning me and my team are going to be re-writing some of our WPF/C# custom controls into C++/WinRT controls and hosting them in XMAL islands. As soon as I add the Microsoft.Toolkit.Wpf.UI.XamlHost nuget package and build I get this visual studio error:

Error NETSDK1135 SupportedOSPlatformVersion 10.0.18362.0 cannot be higher than TargetPlatformVersion 7.0. Gordon.UI.WPF C:\Program Files\dotnet\sdk\5.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 185

deanchalk avatar Jan 20 '21 10:01 deanchalk

Unfortunately system XAML Islands doesn't work with .NET 5. .NET 3 Core included built-in WinRT projections, but .NET doesn't. The WinUI 3 version of XAML Islands will support .NET 5, however it's still in development, no ETA yet.

marb2000 avatar Jan 20 '21 18:01 marb2000

I have removed the bug tag (it's not a bug, it's by design) and I added the feature request for WinUI 3.

marb2000 avatar Jan 20 '21 18:01 marb2000

@marb2000 and @michael-hawker, it's kind of astonishing that XAML Islands are not being supported in .Net 5 and that this "is by design". Why bother with the WPF modernization saga if the real intent was to switch to WinUI? @deanchalk had a reasonable expectation that XAML Islands would be carried forward to .Net 5. There was no messaging suggesting otherwise.

Strange.

Noemata avatar Jan 21 '21 02:01 Noemata

@Noemata Windows UI on some release 3.x (I presume this will be roughly in sync with .NET 6 release) will support WPF, WinForms, and XAML Islands. I imagine they've had to go through a lot of rearchitecture to get this to work, so it makes sense.

https://github.com/microsoft/microsoft-ui-xaml/blob/master/docs/roadmap.md

Philip-S-Martin avatar Jan 21 '21 15:01 Philip-S-Martin

I accepted the deemphasis WPF when UWP was being heralded. It's gotten progressively harder to accept the choices being made by Microsoft. Some of these choices would be easier to swallow if some concessions were made about past mistakes, reducing the likelihood of repeats. Anyhow, I'll stop whining for the rest of this year and try to be part of the solution rather than part of the problem. If December roles around and XAML land is still unsettled, I'll crawl out from under the rock again.

Here's the source material for XAML Islands v2:

"What is your roadmap for XAML Islands v2? XAML Islands v2 is intended to ship as a part of WinUI 3.0. Therefore, v2 will support the same Windows 10 versions as WinUI 3.0. We are planning to release v3 major release of WinUI during the first half of 2020. WinUI is an open source project, and you can follow the latest roadmap and news at: https://github.com/microsoft/microsoft-ui-xaml/blob/master/docs/roadmap.md"

https://blogs.windows.com/windowsdeveloper/2019/06/13/xaml-islands-v1-updates-and-roadmap/

When I read this it sounded like .Net 5 would have this. Seems like too many eggs are being put in the WinUI basket.

Noemata avatar Jan 21 '21 15:01 Noemata

The blog post is out of date. Too many things happened between this blog post and today (including the pandemic).

Some clarifications.

  • We announced through various channels that the XAML system, the XAML that comes with the Windows 10 operating system and uses the Windows.UI.XAML namespace, will no longer be updated (including XAML Islands v1). We moved all of our efforts to WinUI 3 (and WinUI 2.x).
  • WinUI 3 uses .NET 5 (no backward compatibility of .NET 3 Core) and will be upgraded to .NET 6 when .NET 6 reaches GA.
  • WinUI 3 is a re-architecture of the whole platform that requires redoing many parts to eliminate the dependencies of the operating system. Also, WinUI 3 requires decoupling the platform from UWP and making it work on Win32 (in addition to UWP). This will better integrate XAML with Win32 applications; therefore, we will have a much better experience in the XAML islands.

We know that it is frustrating when some technologies advance at a pace, like .NET, and others do not do it in time. But this effort that the team (WinUI 3) is making, in sync with other partners such as .NET and Visual Studio, is to solve this problem (and others). For having an alignment between all these technologies and updating at a similar rate.

marb2000 avatar Jan 21 '21 19:01 marb2000

@marb2000, thanks for the clarification. The roadmap here: https://github.com/microsoft/microsoft-ui-xaml/blob/master/docs/roadmap.md

Needs clarification as well. It's not obvious that XAML Islands go away with the initial introduction of .Net 5 and will reappear post WinUI 3.x release. Having information about the impact of the .Net Native compiler going away would be helpful so we know how tooling and deployments are affected (secured). Likewise for some other bits that re going away. It would help to mention WPF and where it fits in with WinUI. WPF devs might again feel deemphasized by this chart. Not a good thing given a lot of WPF positives were initiated by Microsoft of late.

As you know tech going in and out of scope diminishes confidence and complicates planning. If Microsoft gives us an honest, complete and sober expression of direction we'll all be better off. I very much appreciate all the work you're doing @marb2000.

I carefully track what you're up to. You're one of the UWP stars at Microsoft! It's been sad to see some of the changes within the team.

Noemata avatar Jan 21 '21 20:01 Noemata

Thanks @Noemata I opened a internal conversation about whether we should accelerate the support of XAML Islands for WinUI 3. It was moved to 2022 but let's see if we can create a solid engineering plan to support it in 2021. This will enable that WPF and WinForms .NET 5 apps can host WinUI 3 controls.

About using .NET 5 instead .NET Native for UWP WinUI 3 apps, we understand your concerns about perf and security, but .NET team is very confident about offering something as good as .NET Native with the steady perf improvements that they are doing in each release of .NET. I believe on them. They are the experts. 😊

marb2000 avatar Jan 26 '21 01:01 marb2000

@marb2000 , you've answered all of my questions here and elsewhere. I think I've got the full picture now, to the extent I need it for my decision making. Thank you.

Noemata avatar Jan 26 '21 04:01 Noemata

I have started porting XAML Islands to .NET 5 - https://github.com/nesherhh/XamlIslandsNET5

nesherhh avatar Sep 12 '21 12:09 nesherhh

I have started porting XAML Islands to .NET 5 - https://github.com/nesherhh/XamlIslandsNET5

Thanks for letting us know, FYI @marb2000.

Just curious why you didn't fork the repo to start and maintain history & comparison of your changes from this base?

michael-hawker avatar Sep 13 '21 16:09 michael-hawker

It is a part of my pet project. I have removed many projects because I need just the MapControl. Should I fork instead? Is it possible after cloning first?

nesherhh avatar Sep 14 '21 04:09 nesherhh

Should I fork instead? Is it possible after cloning first?

I'm not sure about that, you may need to fork it, and then from your local repo you could add that as an origin and try and rebase all your changes on-top of the repo without the removals.

At this point, just keep us posted on how your project goes, and we'll see if we hear back from the WinUI folks if they have interest. They're pretty heads down on getting WinUI 3 out the door at the moment, so it may take them a bit to get back to us.

Thanks!

michael-hawker avatar Sep 14 '21 17:09 michael-hawker

Is it in a progress?

pcfulife avatar Jan 17 '22 13:01 pcfulife

Is this dead, years later? Can we still not use WinRT controls in a .NET 5.0 WPF desktop app? I'm really questioning the future of WPF, this is all so incredibly confusing, I can't tell the difference between all of these slightly overlapping paradigms anymore, WPF/WinRT/UWP/WinUI, it's all so horribly confusing.

duckfist avatar May 09 '22 19:05 duckfist

PLEASE SHARE XAML ISLANDS DEV PROGRESS!!!

Dev-Taehui avatar Mar 12 '23 06:03 Dev-Taehui

@Dev-Taehui I think they are blocked by upstream: https://github.com/microsoft/microsoft-ui-xaml/issues/7104

boppbo avatar Mar 15 '23 08:03 boppbo

Islands was mentioned by the platform team in the community call here last month: https://www.youtube.com/live/xcgc5CLqUkM?feature=share&t=2997

That is the path forward, so watch the Windows App SDK for updates. Haven't had a chance to watch the call from today, so not sure if any update was provided.

michael-hawker avatar Mar 15 '23 22:03 michael-hawker

@boppbo @michael-hawker The app I created relies entirely on XamlIsland, so I was very nervous because I had no news of XamlIsland. I apologize for my aggressive behavior. I've seen the video, but I missed the part about XamlIsland.

Fortunately, I'm relieved that it's developing well internally. I hope the preview version comes out soon.

Dev-Taehui avatar Mar 15 '23 23:03 Dev-Taehui

@Dev-Taehui appreciate you calling that out. I understand there's a lot of changes happening at the moment and it can be frustrating. I know the platform team is working really hard on moving things forward as best they can.

We too have been waiting for it to leave experimental releases so we can better close this repo and point folks to their new home. Hopefully, we'll have more ideas of when that might be in the next few months from future updates from the platform team.

michael-hawker avatar Mar 16 '23 00:03 michael-hawker