我的WinUI3应用程序中有一个Microsoft.ui.xaml.dll
无法加载的异常。我在nuget包括了Microsoft.UI.Xaml和Microsoft.Graphics.Win2D。
System.DllNotFoundException
HResult=0x80131524
Message=Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
Source=TibraUI
StackTrace:
at TibraUI.Program.XamlCheckProcessRequirements()
at TibraUI.Program.Main(String[] args) in C:\Users\Bryan\src\tibra\Tibra\TibraUI\obj\x64\Debug\net6.0-windows10.0.19041.0\win10-x64\App.g.i.cs:line 28
WindowsVersion21H1构建19043.1348
我的App.xaml
<Application
x:Class="TibraUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TibraUI">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
发布于 2021-12-13 20:30:18
将包作为启动项目运行。这不是直观的,但主要项目并不意味着要运行。
这个答案只适用于那些创建包含包项目的项目的人。
发布于 2022-10-27 06:15:09
在应用程序项目文件中,在主PropertyGroup中添加<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
,如下所示。
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>EPicker</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
</PropertyGroup>
发布于 2021-12-20 11:56:01
我以下列方式解决了这一问题:
我在命令提示符下使用WinUI新的unoapp-winui- new 6创建了一个Uno .NET 3.NET 6项目。我必须从以下位置更新Windows.Desktop.csproj引用:
<ItemGroup>
<FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" RuntimeFrameworkVersion="10.0.18362.16" />
<FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" TargetingPackVersion="10.0.18362.16" />
</ItemGroup>
至:
<ItemGroup>
<FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" RuntimeFrameworkVersion="10.0.19041.22" />
<FrameworkReference Update="Microsoft.Windows.SDK.NET.Ref" TargetingPackVersion="10.0.19041.22" />
</ItemGroup>
在Windows.Package.wapproj中,我更新了
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="[1.0.0-experimental1]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>
至
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="[1.0.0]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>
(另见https://github.com/unoplatform/uno/discussions/7617)
在VisualStudio2022年预览1.1中的Configuration中,我必须将Windows.Desktop平台更改为x64 (was x86)。Windows.package也应该是x64。
我将Windows.Package项目设置为启动项目。我可以在没有错误的情况下构建和启动应用程序。
https://stackoverflow.com/questions/70100728
复制相似问题