-
Notifications
You must be signed in to change notification settings - Fork 334
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
.NET 6 and WINUI3 fails to start Unable to load DLL 'Microsoft.ui.xaml.dll' #1762
Comments
Currently, get same issue with .NET 5 too though
Works on a Machine with Visual Studio and Visual Studio Extension installed. |
Seems like others are having similar issues #974 |
I've seen that when the VCRedist wasn't installed on the target machine, which would explain why you don't see it on a machine with VS installed. Xaml.dll is generally the first runtime DLL to get loaded (trying to get static APIs from the Application class), so multiple install issues can show up with that message. |
@MikeHillberg Thanks, that was the solution to this problem. |
@MikeHillberg this indeed sorted the issue 👍 |
I think the problem here is the assumption that you can just xcopy your build output to another PC and run it when you put this in your project file: <!-- This bundles the .NET Core libraries -->
<SelfContained>true</SelfContained>
<!-- This bundles the WinUI3 components -->
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained> I see a few potential fixes for people running into this problem:
|
Yes, is WRT the .NET runtime, not the WindowsAppSDK runtime. |
I'm having this issue as well and don't know what the solution is. I already have the Redistributable. |
When I run Packaged app on my machine it works. When I run Unpackaged app it doesn't. When I run exe from console it doesn't work. When I deploy an app to another machine it doesn't work. When I say it doesn't work it means I am getting an error either in Event Viewer or dialog box "Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies" |
I'm still having the same problem, also after reinstalling VCredist 14.30.30704. |
@candritzky I had the same issues on Windows 10 version 1909 and installing the VC++ runtime didn't fix it. I copied the following DLLs from my dev PC to my apps directory on the target PC and it worked. They might not all be required though: |
I just installed VS 2022, and the WindowsAppSDK.Cs.Extension.Dev17.Standalone.vsix I started a new WinUI3 project form the templates. F5 debug running packaged is ok, but I get this error when I select WinUIDeploy (Unpackaged) . This is trying to start within VS. |
I had to change this in the .wapproj, from <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" /> to <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0">
<IncludeAssets>build</IncludeAssets>
</PackageReference> and finally got the packaged app to install and run on my dev pc (outside of VS2022) and on two non-dev pcs. I didn't need to install the VC redistributables. |
If you are trying to run unpackaged version, do not forget to add this code to "csproj" file. <WindowsPackageType>None</WindowsPackageType> |
When I try this the code doesn't compile because it is now missing all xaml references. For example, Application and Window are no longer found. |
has this been resolved? same issue. |
@MikeHillberg Ping on this - I'm getting the same issue with 1.0.1. |
I have this issue as well using 1.0.1 @niels9001: Funny to see you here too. |
I'm getting the same problem on 1.0.1 as well. Any timeline on when it'll be resolved/fixed? |
I'm getting the same problem on 1.0.2 also today. Is there any known workarounds until this is resolved? |
What do you mean by packed and unpacked? With MSIX (packaged) and without MSIX (unpackaged)? |
Yes MSIX packed. |
What did you change between the known good version and the crippled version? |
As commented earlier, the problem started when I setup for remote debug over the local network. I had to try and error a couple of times until I got the settings right to work with MSIX packed to remote debug on the target, but at that point I lost the capacity to run the app unpacked anyware. |
The good news on this one is that I did find the source of the problem in the publish profiles. While trying to get the settings right for remote debugging I changed the default target locations in the Publish Profles. Replacing the files in the project->Properties->PublishProfiles with a copy of the untouched ones from the good project fixed the problem. The crippled app now runs normally (I haven't try the remote debug yet). Lesson learned: Don't mess with the publishing profies! |
In one case.the launch settings file got hidden from git and didn't get checked in. The launch error is completely unhelpful trying to troubleshoot this |
Well, it seems that I claimed victory too soon. The crippled app started to fault again in Main() -> XamlCheckProcessRequirements(); |
I'm getting this exact error message when trying to run the default WinUI 3 project template. How do I fix this? |
Once the app started to fail, I couldn't find a way to fix it. So, I started the project from scratch a couple of times, and gave up trying to debug it to a remote machine. In my case the release MSIX pack installs fine in the target machine. |
Make sure VS and other required stuff is up to date. Try to delete all WASDK/WinUI cache in the .nuget folder. That did the trick for me the other day. |
Thanks @dshe , i would never have figured this out. I'm investigating WinUI 3 for future projects and a POC, after 2 hours wasted on something silly, i am seriously considering ditching it. Appears to need serious time to mature. |
This issue occurs when starting the packaged project via WinUI App project directly. Add But this is not intuitive, when you try to change packaged project to non-packaged project/ run WinUI App project directly. If you create WInUI project only (the template without packaging project), no such issue, and don't need to add This is so confused and inconsistent to handle WinUI App project. |
I’ve tried to make that argument many times. It’s how all the other packaged app projects work. No idea why WinUI needed to be |
This is not WinUI project problem. Yes, it is developer experience flaw. It is quite stranger for a new dotnet developer: But when create WInUI project with packaging project, and I try to run it directly I need add Event I delete the packaging project, the solution still thinks it refence packaging project. |
Having this problem when I try to publish my app as self contained single file. Here are my properties, what am I doing wrong?
|
And here we go again a year later. This nasty problem cripped again in a new app that I was working for months now. Compiled and debug hundred of times without a problem except for the debugger that crassed a couple of time all the way to a blue screen (BugCheck). But the project itself ran just fine until I tried to run a Packed release version without debuger. Then things tarted to go bad. The app didn't start, tried to run Unpacked. Same result. Going back to debug packed, the problem persists, now it doesn't run in any mode. I can't find the way to reverse it back to run debug packed. The non graphical part of the app keeps running in the backgroung and must be killed by the debugger (Ctrl+F5) or by task manager if ran drectly from file Explorer. Both VS and TemplateStudio are up to date. This must be a WinUI problem. I ran the app undr WinDbg Preview and got this out:
as you can see, the real offender icu.dll. |
Yes, I tried that, several references to it are in this thread, but once the damage is made, that won't fix it. And by the way, the same error happens if you try to run a freshly created WinUI3 packed project available in the VS templates. Instead, you should run the pack project created alongside and everything works fine, which I find counter intuitive. See, @mwkldeveloper comment above. |
I'd like to share some of my experiences as I was transitioning from Unpackaged to Packaged and encountered the already discussed issue. The program ran well alongside Visual Studio, but when generating the MSIX and installing it, launching the application was blocked, both on the development machine and on others where I had set up everything needed to run the application. The error in the event log is the same:
Inspired by a blog post from @markolbert, which related similar problems to path handling in their application, led me to investigate the configuration of my project, which uses Sqlite3 with Entity Framework Core, as well as references to assets required by the project. I identified that the problem arose when trying to access the database. To solve it, I made significant changes in the way the database was accessed in the code. Change made: Originally, the database configuration was done as follows:
After modifying the configuration:
Although this modification resolves the issue, I don't understand the connection to the problem seen in the event log. I am relatively new to desktop application development, especially with WinUI3. I hope this can also be of use to you, and that you do not disregard the recommendations already mentioned. |
Describe the bug
When running WINUI3 on Windows 10 ( 21H1 19043.1083 ) looks like the application never launches, but is application crashes with the below error in the event log
Steps to reproduce the bug
Packaged
Unpackaged,
Packaged
Unpackaged,
Expected behavior
For the application to launch.
Screenshots
No response
IDE
Visual Studio 2022
NuGet package version
Microsoft.WindowsAppSDK 1.0.0-preview3
Project type
Windows version
Windows 11 (22000), May 2021 Update (19043)
Additional context
No response
The text was updated successfully, but these errors were encountered: