当前位置:网站首页>c#控制台格式化代码
c#控制台格式化代码
2022-06-30 02:36:00 【哀莫离裳】
控制台格式化代码
前言
原文来自于:半栈程序员
https://mp.weixin.qq.com/s/Yt8okg6qmm5h92WuHfQhrw
我不得不承认,在 code review 的时候,我花费了很多时间来研究 C# 的代码格式问题,这是没有太大意义的工作,我应该专注于其他事情,而不是观察同事是否忘记格式化代码,或者是使用了其他不同规则的代码编辑器。
现在,我们可以使用 dotnet format 检查代码格式问题。这是 .NET 6 的新功能,.NET CLI 引入了 dotnet format 命令 ,并且它是内置的命令。
需要注意的是,如果你安装了 .NET 6 Preview 7 SDK 或更高版本,应该使用 dotnet-format 而不是 dotnet format, 否则运行命令会报错。
格式化解决方案中的所有代码:
dotnet format ./solution.sln
格式化单个项目的代码
dotnet format ./src/application.csproj
验证所有代码的格式是否正确:
dotnet format --verify-no-changes
格式化 src 和 tests 目录中的所有代码,并排除 src/submodule-a 目录的代码:
dotnet format --include ./src/ ./tests/ --exclude ./src/submodule-a/
格式化并输出详细信息
dotnet-format -v diag
格式化并记录报告到文件
dotnet format --report ./report.json
边栏推荐
- What is a self signed certificate? Advantages and disadvantages of self signed SSL certificates?
- AutoJS代码能加密吗?YES,AutoJS加密技巧展示
- How long is the general term of the bank's financial products?
- What are the requirements for NPDP product manager international certification examination?
- Enlightenment from the revocation of Russian digital certificate by mainstream CA: upgrade the SSL certificate of state secret algorithm to help China's network security to be autonomous and controlla
- FDA mail security solution
- Five cheapest wildcard SSL certificate brands
- 模板参数包和函数参数包
- What is an X.509 certificate? 10. 509 certificate working principle and application?
- How do PMP candidates respond to the new exam outline? Look!
猜你喜欢

Bubble sort

代码签名、驱动签名的常见问题解答

2. < tag dynamic programming and 0-1 knapsack problem > lt.416 Split equal sum subset + lt.1049 Weight of the last stone II

Quick sort

桶排序

Playful palette: an interactive parametric color mixer for artists

学术汇报(academic presentation)/PPT应该怎么做?

选购通配符SSL证书注意事项

What is an X.509 certificate? 10. 509 certificate working principle and application?

【postgres】postgres 数据库迁移
随机推荐
2.< tag-动态规划和0-1背包问题>lt.416. 分割等和子集 + lt.1049. 最后一块石头的重量 II
JS advanced -h5 new features
DHU programming exercise
打造创客教育中精湛技艺
JMeter obtains cookies across thread groups or JMeter thread groups share cookies
身份证号的严谨判断精确到队后一位
LeetCode 3. 无重复字符的最长子串
CMake教程系列-03-依赖管理
Traffic, but no sales? 6 steps to increase website sales
DHU programming exercise
DHU programming exercise
Can autojs code be encrypted? Yes, display of autojs encryption skills
Several key points recorded after reviewing redis design and Implementation
快速排序
Global and Chinese market of mobile commerce solutions 2022-2028: Research Report on technology, participants, trends, market size and share
How do PMP candidates respond to the new exam outline? Look!
Weekly recommended short video: why is the theory correct but can not get the expected results?
如何预防钓鱼邮件?S/MIME邮件证书来支招
2022年7月深圳地区CPDA数据分析师认证
True love forever valentine's Day gifts