接触了下 Microsoft.Toolkit.Mvvm和 CommunityToolKit.Mvvm,一开始项目还好好的,突然有一天编译就出问题了。使用特性标记Binding的变量时候会提示特性重复和自动生成的变量和方法重复。后来在韩网上找到个解决方案,修改下项目文件添加以下内容就能避免编译错误。
<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
<!-- Work around https://github.com/dotnet/wpf/issues/6792 -->
<ItemGroup>
<FilteredAnalyzer Include="@(Analyzer->Distinct())" />
<Analyzer Remove="@(Analyzer)" /> <Analyzer Include="@(FilteredAnalyzer)" /> </ItemGroup>
</Target>
说实话我没搞明白这个问题到底咋出现的,有人能说说嘛