CommunityToolkit / Microsoft.Toolkit.Win32

ARCHIVE - This repository contained XAML Islands wrapper controls and tooling for XAML Islands with WinUI 2, see readme for more info about XAML Islands with WinUI 3 and the WindowsAppSDK.
https://aka.ms/windowsappsdk
Other
384 stars 89 forks source link

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

Open matthew25187 opened 3 years ago

matthew25187 commented 3 years ago

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

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.

ghost commented 3 years ago

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 🙌

pcfulife commented 3 years ago

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

r-work commented 3 years ago

Same issue here.

JensNordenbro commented 3 years ago

Same on Winforms

nesherhh commented 3 years ago

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

JaykeBird commented 3 years ago

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.

michael-hawker commented 3 years ago

@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.

deanchalk commented 3 years ago

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

marb2000 commented 3 years ago

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 commented 3 years ago

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

Noemata commented 3 years ago

@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.

Philip-S-Martin commented 3 years ago

@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

Noemata commented 3 years ago

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.

marb2000 commented 3 years ago

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

Some clarifications.

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.

Noemata commented 3 years ago

@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.

marb2000 commented 3 years ago

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. 😊

Noemata commented 3 years ago

@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.

nesherhh commented 2 years ago

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

michael-hawker commented 2 years ago

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?

nesherhh commented 2 years ago

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?

michael-hawker commented 2 years ago

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!

pcfulife commented 2 years ago

Is it in a progress?

duckfist commented 2 years ago

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.

Dev-Taehui commented 1 year ago

PLEASE SHARE XAML ISLANDS DEV PROGRESS!!!

boppbo commented 1 year ago

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

michael-hawker commented 1 year ago

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.

Dev-Taehui commented 1 year ago

@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.

michael-hawker commented 1 year ago

@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.