我正在使用WinUI 3.0和C#编写UWP Windows应用程序,然而几天前开始出现以下错误:
CS0433 The type 'NavigationView' exists in both 'Microsoft.UI.Xaml, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' and 'Microsoft.UI, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'
这是自动生成代码中导致错误的片段:
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.UI.Xaml.Markup.Compiler"," 0.0.0.0")]
private global::Microsoft.UI.Xaml.Controls.NavigationView settingsNavPane;
目前为止,我通过删除/bin
和/obj
文件夹中的内容来解决这个问题,但问题似乎仍然存在。
我知道这是编译器错误,因此我尝试在.csproj文件中添加引用:
<References>
<Reference Include="Microsoft.UI.Xaml.dll"/>
</References>
我不知道是否漏掉了什么显而易见的东西,但这也没有解决问题。如何修复?