【问题标题】:JetBrains Rider does not ignore autogenerated migration files in inspection for buildJetBrains Rider 在检查构建时不会忽略自动生成的迁移文件
【发布时间】:2022-10-19 22:37:54
【问题描述】:

系统:MacOS Monterey、JetBrains Rider 2022.2.1、.NET 6.0.6

我无法从 Rider 构建我的解决方案,因为我的一位同事在迁移中添加了下划线,并且我们有一个 Stylecop 规则集用于一些代码分析,我不知道如何为自动生成的迁移文件禁用它。如果我使用dotnet rundotnet build 从终端构建或运行我的解决方案,它工作正常。

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

我的迁移文件夹中还有一个.editorconfig 文件,其中包含以下内容,但这对我没有帮助。

[*.cs]
generated_code = true

我还尝试在 Rider 中设置检查设置,并将文件夹“迁移”添加到“要跳过的元素”部分或生成的代码部分。

似乎没有任何效果,这真的很痛苦。

【问题讨论】:

    标签: .net entity-framework-migrations jetbrains-ide build-error jetbrains-rider


    【解决方案1】:

    您可以通过在迁移文件顶部添加自动生成的标题/注释来抑制此警告,如下所示,

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

    这将允许文件构建

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-20
      • 1970-01-01
      • 2019-06-17
      • 1970-01-01
      • 1970-01-01
      • 2020-01-07
      • 1970-01-01
      • 2020-11-05
      相关资源
      最近更新 更多