use .editorconfig
file:
[**/Migrations/**.cs]
generated_code = true
dotnet_analyzer_diagnostic.severity = none
or use .csproj
:
<Project>
<ItemGroup>
<Compile Remove="Migrations\**\*.cs" />
<None Include="Migrations\**\*.cs" />
</ItemGroup>
</Project>