Modernize your UWP app with preview UWP support for .NET 9 and Native AOT #9983
Replies: 43 comments 133 replies
-
This is amazing, you've really made my day with this announcement. The application I develop has been stuck waiting for InkCanvas support in WinUI 3, and gradually a few of our libraries have been dropping .net standard 2.0 support, leaving us to maintain our own forks. I have a small question regarding ARM64 support as I'm using a Surface Pro 11 as my main development machine. The "Project Templates for UWP projects targeting .net 9 and Native AOT" VSIX in the blog doesn't seem to support ARM64 versions of Visual Studio, is there a chance that we'll see support for that in the future? Additionally, I'm curious to know if the support for .net 9 means that we'll be able to debug on ARM64 natively. At the moment I'm compiling to X64 and it works well, but it would be nice to get rid of the emulation layer if possible, as I can't currently run the app on ARM64 natively without a .NET Native build. Again, thank you all SO... SO MUCH. |
Beta Was this translation helpful? Give feedback.
-
Currently my project builds faster using .NET Native in Release configuration than using .NET 9 with AOT in Debug configuration. |
Beta Was this translation helpful? Give feedback.
-
First, thank you very much!
I'm getting an "Operation is not valid due to the current state of the object." error when creating the project from the VS template. I'm not sure if the following issue is because of this error. App won't build with the following. I tried installing the 8.0.4 System.Text.Json, but can't resolve the error. NETSDK1060 Error reading assets file: Error loading lock file 'C:\Users\Carlo\source\repos\APP UWP with NET 9 Test 1\APP UWP with NET 9 Test 1\obj\project.assets.json' : Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. APP UWP with NET 9 Test 1 C:\Program Files\dotnet\sdk\9.0.100-rc.2.24466.31\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 266 |
Beta Was this translation helpful? Give feedback.
-
Will it be supported on Xbox? |
Beta Was this translation helpful? Give feedback.
-
I tried out the preview and it is overall working great! Here are some issues I observe (I use a UWP app + win32 helper with a separate packaging project)
|
Beta Was this translation helpful? Give feedback.
-
So with the release of RC2 does this process change? |
Beta Was this translation helpful? Give feedback.
-
does this mean that UWP is comming back as GDKs account barriere makes it a bad option for xbox support and UWP was fine for that ? |
Beta Was this translation helpful? Give feedback.
-
I am currently trying to upgrade a pretty large project to modern UWP. It’s a bit tedious because most referenced UWP packages can’t be used as they are and need to be adjusted locally. Right now, i use local builds amongst others of
So far i recognized several issues (in no particular order)
Overall, the preview does pretty good for what i was waiting for years ❤️. I am still far from getting my project running though. |
Beta Was this translation helpful? Give feedback.
-
I want to come back to an issue that @lhak described above: content files of an UWP app are packaged at a different path in a separate wapproj. They moved into an |
Beta Was this translation helpful? Give feedback.
-
I've followed migrations steps from the article, installed .NET SDK 9.0.200-preview.0.24527.8 and Windows SDK 10.0.26100.1742 and encountered a few issues that I hope you can help address:
|
Beta Was this translation helpful? Give feedback.
-
Hi, I work for a company where we have created a line of business UWP app (not in the Store) over the last 7 years. Just the other day we were discussing the process for moving from UWP to an app developed with WindowsApp SDK, and all the issues that would entail. This new UWP for .Net 9 project has come at just the right time for us, as it will provide a more step by step approach to migration, allowing us to migrate firstly to .Net 9, then to WinUI3, and finally to the full Win32 model. I've installed VS2022 17.12 Preview 5 and all .Net Desktop and Windows App development components, the latest Windows 11 SDK version 10.0.26100.1742, and also the VSIX for the templates. On creating a new UWP for .Net 9 project, I'm getting the following error on build: Microsoft.UI.Xaml.Markup.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130 This is literally from creation of a new project. No changes made at all. I've rebooted, double checked the installed VS2022 17.12 Preview components, all is as it should be. Can anyone help diagnose or help fix this issue? These are the dependencies that are added by default: I notice that under Packages, the SDK BuildTools are version 10.0.22621, is that correct? Is this the same version that everyone else has? |
Beta Was this translation helpful? Give feedback.
-
First stumbling block, converting one of our class libraries, in our large UWP app, is that is uses the following nuGet package: Microsoft.UI.Xaml.Behaviors.Uwp.Managed However this cannot be installed in a UWP for .Net 9 class library, as it says it's not compatible with .Net 9. An alternative I could use is the following nuGet package: CommunityToolKit.UWP.Behaviors However, whilst that installs, it causes the following error: The type or namespace name 'Xaml' does not exist in the namespace 'Uno.UI' (are you missing an assembly reference?) as it seems that the package is dependent on the Uno.UI package, which is listed in the package manifest as a .net 8 dependency. Installing the Uni.UI nuget package manually, just results is many more errors :-( I guess this are the kinds of issues that are going to crop up as people migrate their UWP apps. It's not the fault of the nuGet package developers that they don't support .Net 9, nor that they for some reason have a dependency on the Uno.UI nuGet package, which is very incompatible with UWP for .Net 9 Other than stripping out functionality from our UWP app, that relies on XAML behaviors, I'm not sure how I can make this functionality work. |
Beta Was this translation helpful? Give feedback.
-
Now that .NET9 is released how should we start? Will the Upgrade Assistant be updated to include the new UWP project format? Or do we have to create a new project on our own and copy the files to the new project? |
Beta Was this translation helpful? Give feedback.
-
Just tried to create a UWP project with .net 9 and the latest VS release. Microsoft.UI.Xaml.Markup.winmd cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130 Which version of this should be used??
Is the nuget.config change still required? Never mind, I didn't realize I needed to leave the SDK version at the latest. Works! |
Beta Was this translation helpful? Give feedback.
-
Working steps with latest of everything are: Install Visual Studio 2022 version 17.12.0, install .Net 9 SDK, install UWP .Net 9 support VSIX, select this template select this target version add this to your project file
So you wind up with this:
|
Beta Was this translation helpful? Give feedback.
-
Now that it's been over eight months since the last blog post about the preview .NET 9 support for UWP, I assume we no longer need to install anything special, as long as we have the latest version of VS, the appropriate workloads, and create a new project using the right template? Should we be using the templates that now ship with VS with names such as "UWP Blank App", etc. (those that do NOT include ".NET Native")? |
Beta Was this translation helpful? Give feedback.
-
We have a UWP HoloLens 2 application that doesn't use any XAML (UI is created with DirectX). I'm attempting to migrate it to .NET 9 using the techniques described above. I've started by adding a new project to the existing folder using the "UWP Blank CoreApplication App" template and now I'm working through the problems one-by-one. So far, so good! |
Beta Was this translation helpful? Give feedback.
-
Hi 👋 I have done some tests with the new .NET 9 support for UWP and all seems to be working nicely except the background tasks. I have test a lot of things based on available peace of documentation here and here without success. I have create a very small test project. Someone has succeed to use one background task with the new tooling? There is some guidance somewhere ? I see the Microsoft Store app (preview) is using a lot of tasks and has been migrated to .NET 9, so I think I miss something. Thank you for your help. |
Beta Was this translation helpful? Give feedback.
-
I've converted our old UWP (HoloLens) app to .NET 9 (UWP) using the latest tools and the tips in this discussion. I did it by creating a new project in the same folder using the "UWP Blank CoreApplication App" template and then tweaking a few things related to COM/WinRT interop. We can deploy it to the HoloLens and run and debug it. This is awesome - thank you! We've been sideloading our old UWP app from a website for months. Our yaml pipeline (in Azure DevOps) runs the following command:
(we sign it later) Now, this command succeeds but there is no MSIX, etc. output to the "C:\agent2_work\8\a\Packages\HoloImmersiveNet" folder like there used to be. I'm assuming this has something to do with how projects and targets have changed since good ol' UWP, but I'm not sure what. I apologize for my ignorance. Is it expected that I'd need to change something MSIX/AppX related after converting my UWP project to .NET 9? Note: there was a warning in the pipeline build log, but I'm assuming it's not related to MSIX packaging...
|
Beta Was this translation helpful? Give feedback.
-
Will .net 10 have any improvements for uwp support ? |
Beta Was this translation helpful? Give feedback.
-
@Sergio0694 Thank you for the good work. We are planning to upgrade a big UWP app to .net 9. It has background services, we are not sure how they will be affected. Secondly, the project is layered (mvvm) with .net standard, should update this .net standard targeting to .net 9 ? |
Beta Was this translation helpful? Give feedback.
-
@Sergio0694, are you able to weigh in on this topic of maybe reinstating support for UWP? https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/ 5144 Based on one of the response from austinbhale, maybe allowing it to work with UWP is not too difficult? I attempted to build what he linked, but I wasn't successful. I think MSAL is the only blocker for my conversion. |
Beta Was this translation helpful? Give feedback.
-
When is the CsWinRT 2.3 GA Date ?
…On Tue, 6 May 2025, 09:23 Sergio Pedri, ***@***.***> wrote:
"It has background services, we are not sure how they will be affected."
That's supported, but you'll need to wait for CsWinRT 2.3 to get those to
work (you need this <microsoft/CsWinRT#1637> and
this <microsoft/CsWinRT#1895>).
"should update this .net standard targeting to .net 9 ?"
Yes, that's recommended to make things AOT-safe. You might actually want
to target net9.0-windows10.0.XXXX.0 directly.
—
Reply to this email directly, view it on GitHub
<#9983 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCE7FRYUKOIFO2CDBMG63L25BIMNAVCNFSM6AAAAABOEIYBJWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMBUGY3TSMA>
.
You are receiving this because you commented.Message ID:
<microsoft/microsoft-ui-xaml/repo-discussions/9983/comments/13046790@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
@Sergio0694 Thanks for all your great job regarding UWP+NET9 support! I'm currently migrating a large app and i'm facing an issue in RELEASE mode: app works fine in DEBUG but in RELEASE mode all XAML binding raise exception:
App use regular MVVM pattern and exception is raised for every viewmodels property access. Adding this undocumented GeneratedBindableCustomProperty attribute seems to solve issue but it's quite strange that I need to add it everywhere. Am I missing something? |
Beta Was this translation helpful? Give feedback.
-
@Sergio0694 & @duncanmacmichael: I have a quick question before I dive down the rabbit hole - does UWP on .NET 9 work with the 'Kiosk Mode' functionality in Windows, specifically the single-app kiosk using Assigned Access? UWP has a nifty and super-secure approach to displaying UI above the lock-screen for kiosk apps using the My concern is that this might be wrapped-up in .NET Native and WinUI 2, so before I go ahead and burn a bunch of time diving into this I figured I'd ask here. Otherwise, we're in a position where we'd be building a brand-new UWP app on .NET Native, with polyfils for our modern .NET dependencies, which I'd like to avoid if we can use modern .NET. Some links for reference:
|
Beta Was this translation helpful? Give feedback.
-
I wan't migrate UWP app with some out of support libraries(like MVVMLight), third party libraries target to .NET Standard 2.1 or libraries target to UAP 10.0.17763. Could there be any problems with third party libraries not being built with .NET 9 support? |
Beta Was this translation helpful? Give feedback.
-
I reproduced a basic but very annoying issue with ItemsControl/ItemsRepeater: if you try to set ItemsSource with non basic IEnumerable, a "value does not fall within expected range" exception occured when PublishAot is activated. I'm using 9.0.300-preview.0.25177.5 SDK (latest VS Preview)
|
Beta Was this translation helpful? Give feedback.
-
Hello 😀, I'm developing a UWP application using .NET 9 with NativeAOT. When I try to publish the project, I get the following error:
I do not explicitly reference System.Private.CoreLib.dll in my project. However, I noticed that my project implicitly references: Microsoft.DotNet.ILCompiler version 9.0.4 Microsoft.NET.ILLink.Tasks version 9.0.5 Both are SDK-implicit references, and NuGet UI says their versions are determined by the SDK and cannot be changed manually. Could the error above be caused by these two implicitly referenced packages, since their versions (9.0.4 and 9.0.5) exactly match the versions mentioned in the error message? If so, how can I resolve this issue? Any help would be greatly appreciated! For reference, the full project source code is available here |
Beta Was this translation helpful? Give feedback.
-
Hi all! First, let me thank all the passionate devs responsible for bringing modern .NET to UWP! I've been able to successfully migrate my app to .NET 9. It was not an easy task, and I've hit a few bumps here and there, but in the end I think it was worth it :). I've been able to generate MSIX files for x86/x64/ARM64, and use MakeAppx to create a bundle, but I'm not able to let Visual Studio create the bundle for me. When I try, I get the following error: I'm wondering if this issue is specific to ARM64 VS (I'm coding on a Snapdragon X Surface Pro), or if it's something I did wrong during the migration process. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
We recently announced preview UWP support for .NET 9, described in detail on the #ifdef Windows blog here: Modernize your UWP app with preview UWP support for .NET 9 and Native AOT. This is an effort to help you with the following:
🚨 Please use this post to provide community feedback, ask questions, and discuss preview UWP support for .NET 9. 🚨
If you hit any issues while trying it out, use the following channels to report them:
Thank you, and we're looking forward to hearing from you!
Beta Was this translation helpful? Give feedback.
All reactions