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
Cannot create a new WinUI 3 app and target .NET 8 #9539
Comments
That error is curious, it is also an error I do not see. Anyway, to go through the important points.
If you want this to work with all frameworks, then using the method in the project templates will work.
|
After rebooting the development machine (ad hoc, just to see if it would help), the project builds and runs on .NET 8 without issues. As others on the GitHub thread have indicated it is not replicable in their existing environments, it seems to me that maybe the documentation should say a restart is required, or the SDK installer should prompt for a reboot? |
Glad to hear you're unblocked! If you come across more detail on what configuration change required a reboot, please let us know. thanks! |
It was a fresh installation of WinUI 3 SDK onto a Window 11 development machine with an existing Visual Studio 2022 environment. |
Hi again, if anyone else hits this, you might also try uninstalling the WinAppSDK template extension from Visual Studio and then re-installing the latest. If you installed the standalone version from a past download link, it won't be updated in-place. Thanks! |
SO X-Post: https://stackoverflow.com/questions/78317988/cannot-create-a-new-winui-3-app-and-target-net-8
Describe the bug
After creating a new WinUI 3 project using the project template, the framework version and nuget references are not current. In this state, targeting .NET 6, the app builds and runs, and you can see the clicky button screen.
The first order of business after executing any project template is to update to the latest framework and packages. With .NET 8, there are documented RID issues that are extern from this SDK. I found a workaround (UseRidGraph) on Stack Overflow to opt out of RID graph pruning, which lets the build pass.
Updating the nuget packages prior to targeting .NET 8 does not change the scenario. The error is introduced when retargeting to .NET 8, not when updating the nuget packages to current.
Build is passing with these props:
However, when you start the app, you get this error:
Steps to reproduce the bug
Expected behavior
Windows Apps should run on .NET 8. The developer experience for starting a WinUI 3 project should be world-class and free of frustrating errors and workarounds.
Screenshots
System.DllNotFoundException: 'Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)' @ App.g.i.cs
NuGet package version
WinUI 3 - Windows App SDK 1.5.2: 1.5.240404000
Windows version
Windows 11 (22H2): Build 22621
Additional context
Windows Apps should run great on .NET 8. The developer experience for starting a WinUI 3 project should be world-class and free of frustrating errors and workarounds.
Recommend maintaining the project templates to work with latest .NET and NuGet packages out of the box.
The text was updated successfully, but these errors were encountered: