I am trying to get a WinUI3 app to run unpackaged.
I have addded the
<WindowsPackageType>None</WindowsPackageType><UseWinUI>true</UseWinUI>
into the project file, and also have
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.5"/>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
I can build this, and run it on my Win11 dev machine, however when tryin to test in a Window10 VM, it does not run, and I see the following in the Event Viewer
Description: The process was terminated due to an unhandled exception.
Exception Info: System.DllNotFoundException: Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: Access is denied. (0x80070005 (E_ACCESSDENIED))
at MyApp.Program.XamlCheckProcessRequirements()
at MyApp.Program.Main(String[] args)
I have installed
.net 6 runtime
Windows App SDK runtime
VC runtime
It looks similar to the discussion here (https://github.com/microsoft/WindowsAppSDK/issues/974) except mine error does have the
Access is denied
at the end.
I have tried everything in the above link , and nothing fixes this.
I am not sure where
Microsoft.ui.xaml.dll'`` is (it is not included in my built files); I do not know where to go to next.
Does anyone have any ideas on how the diagnose this?
Thanks in advance
Did you try in the project file :
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
(Microsoft.ui.xaml.dll is in C:\Program Files\WindowsApps\ + Microsoft.WindowsAppRuntime version directory)
Hi thanks for that.
I was hoping to not have to include everything in the app itself (which I think WindowsAppSDKSelfContained would do?)
Interesting, even on my dev machine, I cannot get into C:\Program Files\WindowsApps (I have no permissions). Is this normal?
I have set permissions of
C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1005.616.1651.0_x64__8wekyb3d8bbwe
(the only x64 folder in there) to ALL for all users, but I still get the same access denied error
There are some issues on GitHub and I have also this problem if I compile in x64 (adding WindowsAppSDKSelfContained is the only workaround I found)
In x86 it works fine for me (tested on Windows 10 21H1, Windows App SDK 1.1.0)
I noticed WinApp 1.2 was now available, so I tried updating to this. I also installed the 1.2 version of the WinApp redsit on the test VM
Now the app would load, however, as I want to check that the webview2 is also installed (which my app will use), I call
string version = CoreWebView2Environment.GetAvailableBrowserVersionString();
But this resulted in
Message:System.TypeInitializationException: The type initializer for 'WinRT.ActivationFactory1' threw an exception. ---> System.UnauthorizedAccessException: Access is denied. (0x80070005 (E_ACCESSDENIED)) at WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName) at WinRT.ActivationFactory
1..ctor()
at WinRT.ActivationFactory1..cctor() --- End of inner exception stack trace --- at WinRT.ActivationFactory
1.As(Guid iid)
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.Make___objRef_global__Microsoft_Web_WebView2_Core_ICoreWebView2EnvironmentStatics()
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.get__objRef_global__Microsoft_Web_WebView2_Core_ICoreWebView2EnvironmentStatics()
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.GetAvailableBrowserVersionString()
at MyApp.MainWindow.CheckWebview2Installed()
So once again a E_ACCESSDENIED error.
I then added the
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
into the project file, and the app now runs.
So there seems to be something with using a shared WinApp library
Thanks for the suggestion, however, I was more worried if the above failed, then other calls will as well,
For now I will go with WindowsAppSDKSelfContained, and hopefully a fix will come around
The basic test application with .Net7.0 core and VS 17.4.4 wasn't running at all after upgrade , so i downgraded VS to previous version 17.4.0, which started App to run in debug mode atleast but it was unable to run if I click on executable directly , it was throwing following error on application log
Application: XXXX.exe
CoreCLR Version: 7.0.22.51805
.NET Version: 7.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.DllNotFoundException: Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
at XXXX.WinUI.Program.XamlCheckProcessRequirements()
at XXXX.WinUI.Program.Main(String[] args)in projdir\obj\x64\Debug\net7.0-windows10.0.19041.0\win10-x64\Platforms\Windows\App.g.i.cs:line 28
Then I tried to set <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained> in the csproj file
and then it started throwing following error :It looks like the webpage at https://0.0.0.0/ might be having issues, or it may have moved permanently to a new web address.
so any idea why is it so?