Skip to content
Discussion options

You must be logged in to vote

Oh find, can disable analyzer content from CommunityToolkit.Mvvm.
In this way, you can use attributes such as ObservableProperty and RelayCommand without triggering analyzer.

  <ItemGroup>
    <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" PrivateAssets="all" />
  </ItemGroup>
  <Target Name="DisableMvvmToolkitSourceGenerators" BeforeTargets="CoreCompile">
    <ItemGroup>
      <_MvvmToolkitAnalyzers
        Include="@(Analyzer)"
        Condition="$([System.String]::Copy('%(Analyzer.Filename)').Contains('CommunityToolkit.Mvvm.SourceGenerators'))"
      />

      <Analyzer Remove="@(_MvvmToolkitAnalyzers)" />
    </ItemGroup>
  </Target>

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Hakoyu
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Hakoyu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants