Modernize your UWP app with preview UWP support for .NET 9 and Native AOT #9983
Replies: 48 comments 179 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.
-
@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.
-
Thanks for sharing this, Duncan — this looks like a solid step toward modernizing legacy UWP apps. Having a clearer path to move toward WinUI 3 and decouple .NET runtime upgrades is a big relief for dev teams, especially those maintaining complex apps. Also excited to see Native AOT support. Faster build times and better debugging are long overdue. On a related note, for teams juggling large app transitions like this alongside feature planning and resource tracking, having a good project management setup helps a ton. We’ve found tools like Celoxis useful — easy to use, with solid support for timelines and dependencies, especially in cross-functional teams. Looking forward to testing this preview. Will share feedback as we dig deeper! |
Beta Was this translation helpful? Give feedback.
-
Is this still in preview? When can we expect GA? |
Beta Was this translation helpful? Give feedback.
-
Hmmm ... I've been following this repo since the announcement of Preview Support. I must have missed the announcement of GA. How to get started talks about additional bits that have to be added by the dev or aren't available yet. There is also a note at the end
Is there uptodate documentation? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to get app service to work with .NET 9 UWP and am failing spectacularly. I hoped the above background tasks solutions would help, as app service also requires to use a winmd file, but after implementing CsWinRT preview version as Christophe did, I am back to square one: app service connection attempts fail with "AppUnavailable" status, which seems to be rooted in runtime component being inaccessible. This is the same issue I get if I reference the app service runtime component as dll without using the preview version of CsWinRT. I've created a repo with sample here: https://github.com/BognaIrena/AppServiceSample_UWPNativeAOT - I'd be grateful for any tips, I'm running in circles. |
Beta Was this translation helpful? Give feedback.
-
Is Xaml Islands (UWP in WPF) supported? If so, where can I find example? |
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