










C# .NET,用trea 改 .cs 或*.cshtml 文件时,trea 经常把文件改成 utf-8 无BOM的。
解决方法:
项目根目录放一个.editorconfig文件。
如果是 visual studio 项目,.editorconfig文件和 .sln 同级。
.editorconfig内容:
root = true [*] charset = utf-8-bom indent_style = space indent_size = 4 end_of_line = crlf trim_trailing_whitespace = true insert_final_newline = true [*.cs] charset = utf-8-bom [*.cshtml] charset = utf-8-bom [*.config] charset = utf-8-bom indent_size = 2
.editorconfig 要放工程根目录,root = true 这行要加。
root = true 的意思是,当前.editorconfig这个文件就是总配置文件,不会在其它目录搜索.editorconfig。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。