我正在 Windows 和 Android 上构建一个 MAUI 项目。 现在新的我试图在 iOS 手机上构建它,它抛出一个异常。
Microsoft.Maui.Controls.Xaml.XamlParseException: '位置 13:46。未找到 DynamicResource'
的 MarkupExtension这是App.xaml,这是我创建MAUI项目时的默认代码。
<?xml version="1.0" encoding="UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:JustAnApp"
x:Class="JustAnApp">
<Application.Resources>
<ResourceDictionary>
<Color x:Key="PageBackgroundColor">#fff</Color>
<Color x:Key="PrimaryTextColor">#000</Color>
<Style TargetType="Label">
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
</Style>
<Style TargetType="Button">
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="BackgroundColor" Value="#2b0b98" />
<Setter Property="Padding" Value="14,10" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
有没有其他人在使用 MAUI 在 iOS 上运行时遇到这个问题?
我预计: 通过 Visual Studio 中的“配对 Mac”在 iOS 手机上运行 C# MAUI 项目。