-
Notifications
You must be signed in to change notification settings - Fork 328
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
Question: .NET 5 UWP apps are already possible, so when will official support arrive? #105
Comments
Does that work like a UWP app, I mean have CoreWindow, support xbox & etc. What you did sounds like how a packages win32 app work but hacked to look like a UWP app |
@ShankarBUS This method does create an actual UWP app and it's using |
I'm so with you here, I wanted to move to .net standard 2.1 a long time ago in my cross platform solution where I want to use gRPC but this beautiful UWP beast is holding me back ;)) plse MS tag and bag this thing !! |
Can't stress this enough. .NET 5 support for UWP has been the number 1 question from the UWP developer community for months now (see for example the recent 3-4 WinUI Community Calls). The messaging from the MS teams on this very important topic for UWP developers has been absolutely catastrophic: First, while the .NET team in its initial .NET 5 introduction blog post mentioned UWP, it has been silent on this topic very much ever since. If you read the blog posts for the different .NET 5 previews...do you see any official comment on the UWP .NET 5 situation? Nope, not at all. It feels like the .NET team has no interest in this topic any longer. For example, see this issue where in May this year, the community explicitly asks for a UWP roadmap for .NET. Do you see any reply by the .NET team there? Did the .NET team assign anyone to this this issue? The answer is: NOPE. Apparently, the .NET team just doesn't care about UWP. Secondly, in the absence of other MS teams to ask or give us answers, the UWP developer community turned to the WinUI team. Now, the WinUI team arguably is the wrong team to ask on this matter here so they get a pass for not knowing the exact status of .NET 5 on UWP. Yet, the answers we do receive month after month of constant asking are incredibly disappointing. Here they are:
So, why are these answers we are getting time and time again really disappointing here? They tell me two things: MS doesn't know how .NET 5 support for UWP will arrive and it doesn't know when. The resulting optics paint a pretty bleak picture of the importance of UWP at MS. .NET 5 is one of the biggest stories for Windows developers out there and communication with the UWP community on this topic has been absolutely abysmal. Lastly, the UWP developer community then went to Project Reunion to ask for clarification and details on the UWP on .NET 5 story. See this issue for example. A community member came - in that thread - to the following conclusion:
To which a Project Reunion team member at MS, @jonwis, replied with the following:
Remember the first point in my post? That the community went to the repo of the .NET team and asked for a ".NET roadmap for UWP"? Remember that that issue received zero care by the .NET team? Remember the second point, where the WinUI team has been telling us that ".NET 5/6/... support might come via Project Reunion"? What I am seeing here is this: No team at MS wants to be responsible for UWP on .NET 5: The .NET team -> Absolute silence in both Preview blog posts and on their repo Is the state of the UWP really so pitiful internally at MS that more than a year after the intial introduction of .NET 5 the UWP developer community has zero clue at all how and when support for .NET 5 will arrive? Are we UWP developers that unimportant to MS that seemingly no one wants to step up, lead that project and have a respectful and constructive interaction with the community? I will leave with this picture from the official .NET 5 introduction blog post: It has been downhill ever since then for the UWP developer community.... |
It seems to all available resources Microsoft spending to Project Reunion and MAUI. And UWP'll die in a few years. |
If it means we can build UWPs without Visual Studio and Windows SDK, that would be great news. Looks like it is basically there. |
On the issue about UWP and .NET 5, I feel since UWP is basically a Windows-targeted solution, it would only make sense for it to evolve with Windows (currently Windows 10). So, since Windows 10 is still taking some shape (e.g. Start menu revamping, etc.), UWP may have to wait. |
@olugt I think the revamping and Windows 10X are being done using UWP? At least the Windows and .NET teams should give the community a concrete answer. If they would not support it, let the community and the customers know. @Aminator Thank you for this wonderful effort. All I am asking the Windows/ .NET teams is to give us a concrete response. |
@Felix-Dev , I'll add some more points that makes UWP future questionable. MS announced the Winget package manager at build. So now we are going to have the MS Store + Winget which I assume has it's own "store" ( source packages). So now we are going to have 2 "sources" for apps that makes no sense whatsoever except if there is a plan to create a new "source" that winget and Windows Store will feed from. MS announced that the Ad platform on MS Store is ending. The fact that UWP uses .net native for compilation and there is no .net native toolchain in .NET 5 that I'm aware of really brings UWP to it's end of life as we know it. Perhaps there are plans next year to hop onto the AOT bandwagon that will give UWP a new direction therefor the lack of response from MS regarding this. I just wish the leadership at MS can address this issue, because it's clear the individual teams are skirting this issue because they themselves probably also don't know. As a developer that uses UWP this is important issue for me , because I have made an investment already in UWP and I don't want to write off that investment. If I need to go the win32 route to prolong my investment I will do that. To me the ideal solution at this moment looks like win32 with AOT as you can do so much more and you still have access to UWP contracts plus an added performance benefit of no sandbox. So MS let there be a fallout in your announcement then at least we can all move forward. @Aminator Thanks for your effort. You have shown more commitment and hope for UWP's future than MS themselves. |
@Aminator on the original question re: Microsoft Store, you should run the WACK ( Although you have the entire .NET Core runtime bundled with your app (which makes it larger and can increase the number of WACK failures), you can reduce the number of DLLs in your package quite significantly; it just takes a lot of trial and error to remove the ones you don't need. |
You should be able to set |
I added this issue thinking our only option would be .NET 5 in a desktop bridge MSIX. Operating from the UWP container is even more exciting since the upgrade path is incredibly clear. If we get Framework Packaging then there shouldn't even be a change in size for the end user (except for their first .NET 5 app). I assume there isn't support for lifecycle functions in this, right? That'll need at least the C#/WinRT projections. |
For me Project Reunion was the official statement of what was slowly started with XAML Islands and MSIX replacing APPX. Basically the admission that WinRT was badly managed since the beggining, with incompatibile .NET variant and very constrained API, followed by the multiple reboots, Windows 8 WinRT with multiple projects, Windows 8.1 UAP with common logic , UWP, XAML Islands,... So basically we are getting proper .NET, WinUI (now written in C++ to cater to MFC guys), and with Reunion it still isn't clear what is going to be. What irks me is that for a while UWP looked like how .NET should have been from the get go (meaning .NET v1.0), and with C++/WinRT those of us that are forced for various reasons to use C++ alongside .NET have lost the nice Visual Studio tooling from C++/CX (apparently we have to wait that ISO C++23 adopts the missing features to improve C++/WinRT tooling story). So with the past experiences of also having invested lost time into Silverlight and XNA, WPF looks like a more solid story for the time being really. MS really needs to decide what message they want to send to the Windows development community. |
Message is pretty clear: "the no-appcontainer crowd from WPF days yelled louder, sorry guys" |
I may have made a bit of oversight though. But it still seems to me that Microsoft is trying to not be distracted by UWP (because to me, the effect of any work done on UWP is only visible with a corresponding update to Windows 10) but to instead focus on Project Reunion (https://github.com/microsoft/ProjectReunion/blob/master/docs/README.md), which seems to be about bringing the best of UWP and others (e.g. WPF) together. But I bet it would be very much like UWP. Project Reunion seems to be what would make apps realise the best features and capabilities Windows 10X and its successors would offer, while making it easy for mostly all existing apps to easily come on board. |
@Felix-Dev On man, I'm so with you here! Was just gonna write a post "How/when will .Net 5 / UWP / WinUI" come together". I am soooo dissapointed by MS. They keep on saying that UWP is the future, but nothing truly happens. I have a 110K+ LOC UWP app, and working on it is harder and harder:
Agreed, more than 100%
I feel exactly the same way. My thinking is that WinRT is soooo complicated behind the scenes, that NO ONE wants to deal with it. They just throw keep throwing the ball to someone else, hopefully it will at some point get fixed. I've been asking for compile time improvements for ages - nothing happened. Seems they will start after fixing Hot Reload, but who knows if/when that will happen. The File/Folder API is a bad joke - it's been known FOR YEARS. We're simply down to workarounds. There's already support for Async Call Stack (so that if you have async calls, they will be remembered in the Call Stack after the async call returns). And yes, they don't work for UWP. Everyone is using .net core 3.1, but UWP is back to 2.2 - I've been asking this in several places. When will UWP use .net core 3.1? No answer. And you know this yourself - we've been asking for improvements in WinRT - has any of them actually been implemented? Even now, if you look at the UWP controls, pretty much all of them has been developed with the "mobile first" in mind. Like, the scrollbar, by default is very small, and you have to hover it and then it'll show up. So, I want the scroll bar to be visible at all times - the fact that this can't happen with just a line of code (in fact, you can do it, with about 1000 lines of XAML), speaks volumes. The list could go on... It simply feels that even inside MS, everyone would just want WinRT to simply go away, but no one does anything about it (side note for MS : everyone would love for WinRT to go away).
This is what I'm talking about. No one wants to deal with UWP / WinRT, and they just throw the ball from one team to the next. (my take, once again, is that the culprit is WinRT, because UWP itself is awesome!)
I've been saying this again and again. It feels that MS is using us as guinea pigs, and whenever they feel like it, they may implement something. They don't trust UWP (or more likely, WinRT) themselves. I've been asking: where is any UWP application developed from MS, that is decently complex (like, 50K+ LOC) ? I have yet to see one. My app has 110K+ LOC, and it's a constant struggle to keep my sanity.
Yes, it's beyond dissapointing.
Not only that, but basically, they keep ignoring the two groups of developers that develop UI apps:
|
@Aminator - Thank for your excellent post and for all the work that went into figuring out and documenting this solution for the community. You’re correct: it’s possible to build UWP apps using .NET 5 already today, as you’ve shown, with some gotchas and limitations as you also wrote. In addition to the way you show, there are other approaches that can work, eg. starting with the packaged desktop app templates we’ve been shipping with the WinUI 3 previews and modifying them to have the apps execute/run as UWP apps instead of desktop apps. We’d like to figure out the right path to enable this end-to-end, including not just the core platform and runtime working but also the tooling, project templates, deployment, store, etc. We’d like to support this in a way that’s forward-looking, durable, and makes it reasonably easy for developers to build apps with the benefits of UWP and the benefits of the latest .NET. In terms of being more open on the approach and roadmap here, we’ll aim to post a discussion topic in the next few weeks to share some thinking and collect the community’s feedback. We’re also open to working to understand ways to better support the community in the short term – given the interest in the solution you posted – while also designing and developing a longer-term solution. I'll be on WinUI Community Call tomorrow (http://aka.ms/winuicall) to answer questions about this as well. |
Can you post back some of the Q&A here? I can't realistically make community calls. |
Here are my questions related to this discussion: Just focused in a different way but nothing really new. I was going to create another issue but then found this one.
|
@Felix-Dev I agree with your analysis.
There is a more optimistic interpretation -- athough unlikely I'll admit -- that the future of UWP relates to future versions of Windows such as 10X. If that's true, they may not be able to share what's coming quite yet. So instead of nothing, there is something, it's just confidential. I still see UWP apps are required for XBox, Hololens, et al. and Win32 isn't going to work there. Unless the rumors about Windows 10X switching over to a web-first approach are true. Then all bets are off and I need to be switching to ASP.NET/React Native yesterday. |
|
Yeah what @maxkatz6 said is correct, you can basically use all the C# 8 features that are syntactic sugar. @robloo You just need to add: <LangVersion>8.0</LangVersion> To your Also yeah, the project-wide nullable setting won't work, and the BCL won't be annotated. That said, you can still add Regarding |
@maxkatz6 Thanks for the linked issues and your comments. I did not know about the CoreRT issue and am glad to see this discussion documented some place. @Sergio0694 Thanks for your comments as well:
Do you both honestly think this is safe with .NET Native? I know there are work-arounds like you stated. I have always avoided them for fear of running across a feature that isn't implemented like I think it is which causes issues in production. I think there are a lot more areas affected than you imply. If there weren't Microsoft would have officially enabled C# 8 support a while ago. Also note that the main feature in C# 8 in my book is nullable reference types. This seems all too dangerous in production code without official support. |
@brabebhin WinUI doesn't support AOT compilation which is important for performance (especially startup) and code security. |
@brabebhin If WinUI supported AOT, then this tread would not exist. That is the problem, MS failed to provide an alternative and reliable upgrade path. MS should show much more support to someone like Andrey Kurdyumov @kant2002 If there is one guy that can make it work it's Andrey. |
Net native used by UWP is buggy and often results in failed builds when adding new stuff, or unexpected runtime behavior, and it is more trouble than it's worth. The reality is the vast majority of developers did not want to waste their time with it. This is not something people want to invest in. I myself found several bugs with it. AOT compilation is surely something that's needed and I am sure it will come in a form that is actually usable. |
@brabebhin I agree that netnative is buggy ans WinUI is future, but it does not provide all current UWP XAML stack (we are currently using InkCanvas, Map, MediaPlayerElement) so we simply can not migrate to WinUI3 right now, and Microsoft WinUI3 roadmap does not suggest any date for these features (not before 2022, maybe later or never ?). So we must wait and continue using old C#, old .NET, and old third party libraries... very frustrating! I |
@Pinox thanks for kind words. I think I receive a lot of support in form of reviewing my PR and helping me dive into CoreCLR/NativeAOT codebase. You overestimate my involvement, since most of my work is just testing and writing articles which show what is currently working, and occasionally fix bugs. Trust me, I'm not most efficient contributor to NativeAOT. I would like to as @brabebhin or any WinUI developer how can I build and run WinUI application only via console, that tremendously help with WinUI + NativeAOT support. I can be reached over email, or finding me in C# discord (low-level channel). Also maybe that issue can be forgotten for good, for every reader of it. |
For mediaplayerelement I have created almost everything custom, the only missing part is fullscreen, which can be achieved with borderless window and a display request. |
If you need .NET>5 in UWP please give a vote on this: https://developercommunity.visualstudio.com/t/Add-NET-678-support-to-UWP/1596483 |
@pubtom I've been following all the news, interviews, discussions etc. on the topic and for me at least UWP as we know it is a dead end. We have invested in it and we are not happy about it either, but we are hopeful that WindowsAppSdk will have feature parity in the near future and the migration could be a lot worse. |
Even WPF and WinForms, which are much older than UWP, get .NET 6 but UWP doesn't. This isn't fair. |
@JaiganeshKumaran Life isn't fair. Move on. |
Certainly true. Kind of insensitive though to put it mildly. Basically saying stop your childish wining. Microsoft's long history of dropping support for what they once pushed onto developers as the future and reinventing things every few years when management changes is hard to stomach though. Poor management direction is a key takeaway here. Microsoft is actively working against devs in this case and worse, working against the very devs that trusted Microsofts UWP promise that it was the future. These devs are the early adopters. Not a good way to run a company. The UWP community is small enough this doesn't matter though and in another 1-2 years once missing features are added to WinAppSDK and we have NativeAOT the migration will be possible. My company isn't waiting for that though. Find another UI framework, cross-platform ones exist that don't have Microsoft's terrible management track record. |
It is incredibly how Microsoft nowadays treat developers. Like this statement. ahhh... |
The Microsoft's management can be summed up by "Indecision is the key to flexibility". I wish I could laugh at this, but the opposite is true. There's just so many things that are wrong here, that, to quote myself, I could write a book. I used to more than love Windows programming -- back when I was working on WinForms/WPF projects. Everything was just working. Now, there are countless bugs because of the great "Windows RetardedTechnology", and I already know they will pretty much never be fixed. Just imagine how bad things are (under the hood) if it's taking so much to port things back to win32. No clear roadmaps, everything just in mid air. You just can't rely on anything, at this point, no matter what you use, WinUI3, UWP, WPF, at some point you'll hit road blocks -- which can set you back for months. To say the current state of affairs is sad is an understatement. |
TRUE. |
Has any interesting to find a way to write UWP on .NET6 normally? I found that using Windows App SDK can debug and package a UWP. But I still have no idea to use XAML with Windows.UI.XAML or WAS. |
UWP with recent .NET6/7 would be great! WinUI3 isn't on-par with legacy UWP+WinUI2 stack. |
But dotnet6 don't have .net native. It will be slower than normal UWP. |
Actually the performance part really depends on what you are doing. |
UWP with .NET 7 and Windows.UI.Xaml is possible with hacks: https://github.com/driver1998/NetCoreApp. WinUI 3 on UWP is blocked these days, trying to call Interestingly, there is |
A hack to allow WinUI 3 work again on UWP, tested on WASDK 1.4.2: https://github.com/driver1998/HookCoreAppWinUI. |
Without support for .NET Native it's impossible to publish the application to the Microsoft Store. If a program doesn't need to be published to the Microsoft Store, honestly whether to use UWP or not doesn't really matter. |
It does matter on non-desktop platforms, at least UWP with .NET 8 and Windows.UI.Xaml runs on IoT Core (you'll need the somewhat niche ARM64 IoT Core though), and some other people are exploring Xbox Dev Mode. Also NativeAOT works just fine on UWP, with that Microsoft Store won't detect it as a .NET app. But currently CoreCLR won't pass WACK dotnet/runtime#96510. |
IMO this is a scenario where users need to manually sideload an UWP package, which is difficult to ask users to do. And when enabling DevMode on Xbox to sideload UWPs the user's Xbox no longer functions as a normal Xbox, and it also requires a developer account of Microsoft Partner Center. I just think forcibly fitting .NET into the existing UWP doesn't make much sense, as it can't be published as a normal app to the Microsoft Store. For developers who simply want to develop and distribute software normally, currently the only viable solution is to use the traditional UWP approach. I hope Microsoft can provide a successor plan for UWP, rather than requiring developers to use some kind of magical workaround to implement new solutions. BTW thank you for posting the issue, is the community currently practicing the use of NativeAOT on UWP? |
Great news: https://devblogs.microsoft.com/ifdef-windows/preview-uwp-support-for-dotnet-9-native-aot/
🎉 |
Question: .NET 5 UWP apps are already possible, so when will official support arrive?
When it comes to .NET 5 support for UWP apps, we don't really have a clear answer yet to how that will look like and when it will come. UWP developers shouldn't have to be stuck on an old .NET version while Win32 developers are seemingly way ahead and can also use the new C#/WinRT language projection.
How to create a .NET 5 UWP app
What I found is that despite Microsoft telling us developers that creating UWP apps running on .NET 5 is not supported yet, it is actually quite easy to do today with minimal setup and it even works with WinUI 3. You can start off with the regular .NET 5 console app template and modify it from there. This process involves three steps: Modifying the project file, adding a package manifest file and generating a PRI file. Be sure to have the latest .NET 5 preview SDK and Visual Studio Preview installed. I have provided samples in this repository.
Project file
You need to add a few properties, NuGet packages and targets. I tried to make it as independent of Visual Studio and the Windows 10 SDK as possible.
Package manifest
The package manifest named
AppxManifest.xml
is needed to register your app with the OS, but notice that it's not the regularPackage.appxmanifest
file you find in old UWP projects, which would generate the finalAppxManifest.xml
for you. If you use an existing one, be sure to remove the package dependency for UWP .NET Core and use the release version of VCLibs.For WinUI 3 you also need to add any types you use from it to your manifest. This also needs to be done for WinUI Desktop.
Resources
It is necessary to have a file called
resources.pri
in your app for any assets, including XAML files, to be accessible by your app. This can be generated usingMakePri.exe
. It takes a configuration file calledpriconfig.xml
as an input. You can create a new configuration file with the commandmakepri createconfig /cf priconfig.xml /dq en-US
. Be sure to remove the following two tags if you want to only create a singleresources.pri
file.Entry point for WinUI 3
A custom entry point needs to be defined for WinUI 3 apps because the automatically generated one applies the
STAThreadAttribute
to theMain
method, which causes a wrong thread exception.Building and debugging
The project can be built either on the command line using
dotnet build
or in Visual Studio, though for WinUI 3 it currently needs to be done in Visual Studio. Do not start the app from Visual Studio, this would execute the.exe
file directly and essentially be a Win32 launch. The app needs to be launched by clicking on the app list entry in the Start menu or the icon on the taskbar. A debugger can be attached from Visual Studio after the app has been started.Issues
The biggest issues with this approach are:
MakePri.exe
is not included in the .NET SDK or a NuGet package.Conclusions
I have been using .NET 5 and WinUI 3 in my own UWP projects for a few weeks now and it has been working quite well and I was able to take advantage of new .NET APIs that I didn't have access to before. The main issues come from WinUI 3 still being in preview, so there are still many missing pieces, which is why I wouldn't recommend it for production use just yet.
Through this process I also came to understand what the main difference between a UWP and a Win32 app is and it all has to do with how the app is launched. It is the
EntryPoint
on theApplication
element in the package manifest that determines if it will be a UWP or a Win32 launch. For UWP it will beYourProject.App
and for Win32 it will always beWindows.FullTrustApplication
.It is also unclear if this type of app will be accepted in the Microsoft Store, so I would like to know more information about that. The other question remaining is the one I stated at the beginning: Since it is possible to build UWP apps running on .NET 5 today, what is the holdup on supporting it officially? It would be great if Microsoft provided additional tooling to make the process easier for developers. I would like to see a rough timetable on when we can see the issues I mentioned resolved. Hopefully we can see it officially supported whenever WinUI 3 is ready for production, so that UWP developers that make the switch can also take advantage of .NET 5 immediately.
The text was updated successfully, but these errors were encountered: