忽略 EditorConfig 中的实体框架迁移文件

问题描述 投票:0回答:1

我有一个包含以下内容的 EditorConfig 文件

root = true

# Generated Code
[{*.Generated.*.cs,*/Migrations/**,*/Scripts/**}]
generated_code = true


# C# files
[*.cs]


# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4

# New line preferences
end_of_line = crlf
trim_trailing_whitespace = true
insert_final_newline = false

etc. (another ~500 lines of rules)

我的项目结构如下所示,.editorconfig 位于项目根目录中。

但是,我仍然收到 Migrations 文件夹下文件的编译器警告,如果它们被标记为生成的代码,则应忽略这些警告。

我不确定我的 EditorConfig 有什么问题。 我尝试了几种不同的变体,但似乎都不起作用。我已尝试以下所有方法:

仅检查文件:(单个星号)

[{*.Generated.*.cs,Migrations/*,Scripts/*}]
generated_code = true

分成多个语句:

[*.Generated.*.cs]
generated_code = true

[*/Migrations/**]
generated_code = true

[*/Scripts/**]

generated_code = true

在根处分成单独的语句:

[*.Generated.*.cs]
generated_code = true

[Migrations/*]
generated_code = true

[Scripts/*]
generated_code = true

完成此操作所需的正确语法是什么? 谢谢

visual-studio entity-framework editorconfig
1个回答
0
投票

快速提醒 - 当您将标签添加到项目文件时,DocumentationFile 选项适用于项目中的所有文件。如果您不想全局忽略 CS1591 警告,我们建议您在警告中提到的相应位置添加 XML 注释(您可以参考此链接了解更多信息)或在相应的位置添加注释文件使用#pragma warning禁用CS1591(同样,您可以参考此link了解更多详细信息)。

© www.soinside.com 2019 - 2024. All rights reserved.