1

System: MacOS Monterey, JetBrains Rider 2022.2.1, .NET 6.0.6

I cannot build my solution from Rider because one of my colleagues added an underscore to a migration and we have a Stylecop ruleset for some code analysis and I don't know how to disable it for autogenerated migration files. If I build or run my solution from terminal with dotnet run or dotnet build it works fine.

20220823130032_Dep_ExcludeTotalCapacityInParent.cs(7, 26): [CA1707] Remove the underscores from type name Plancise.Data.EF.Migrations.Dep_ExcludeTotalCapacityInParent

I have also a .editorconfig file in my migration folder with the following content but this doesn't help me.

[*.cs]
generated_code = true

I also tried to set the inspection settings in Rider and add the folder "Migrations" to the section "Elements to skip" or the Generated Code section.

Nothing seems to work and this is really a pain in the ass.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Alex Pab
  • 107
  • 1
  • 1
  • 5

1 Answers1

0

You can suppress this warning by adding an auto generated caption/comment at the top of the migration file like this,

// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore.Migrations;

This will allow the file to build