当前位置:网站首页>在 .NET 6 中使用 dotnet format 格式化代码
在 .NET 6 中使用 dotnet format 格式化代码
2022-06-25 04:01:00 【dotNET跨平台】
我不得不承认,在 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更多 dotnet-format 的信息,可以查看下面的链接
https://github.com/dotnet/format
END
做了一个 .NET 的学习网站,内容涵盖了 分布式系统,数据结构与算法,设计模式,操作系统,计算机网络等, 回复 dotnet 获取网站地址, 回复 面试题 获取 .NET 面试题。

边栏推荐
- 机器学习深度学习——向量化
- GBase 8s 锁的分类
- Office macro virus bounce shell experiment
- js的arguments
- Retrofit 源码分析
- CTF_ Web: how to recognize and evaluate a regular expression
- GBASE 8s 总体架构
- 第九章 APP项目测试(2) 测试工具
- Use of deferred environment variable in gbase 8s
- Upgrade PHP to php7 The impact of X (I). The problem of session retention. Keep login
猜你喜欢

小白学习MySQL - 统计的'投机取巧'

CTF_ Web:8-bit controllable character getshell

论文笔记: 多标签学习 ESMC (没看懂, 还没写出来, 暂时放这里占个位置)
![[untitled]](/img/68/5e711f7c473dcea54a56f7b7e48604.png)
[untitled]

js的sort()函数

PHP extracts and analyzes table contents, and collects bidding information
三角形类(构造与析构)

A detailed summary of TCP connection triple handshake
![[esp32 learning path 6 - Flash encryption]](/img/4c/f317ca4823dca50a9bccd285967ab0.png)
[esp32 learning path 6 - Flash encryption]

关于TCP连接四次握手(或者叫四次挥手)的详细总结
随机推荐
i. Max development board learning record
JS call() and apply()
彻底理解数据库事务
Cnpm: unable to load file c:\users\administrator\appdata\roaming\npm\cnpm PS1 because running scripts is prohibited on this system.
CTF_ Web: deserialization learning notes (I) classes and objects in PHP
CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep
Anaconda installation +tensorflow installation +keras installation +numpy installation (including image and version information compatibility issues)
JS arguments
unity Quad剔除背面并剔除透明部分的shader
Le chemin de l'apprentissage immutable - - Adieu à la copie traditionnelle
What is persistence? What are RDB and AOF in redis persistence?
Record the problem of C # print size once
js的arguments
2.0springmvc uses restful
Gbase 8s parallel operation problem scenario description
CTF_ Web: how to recognize and evaluate a regular expression
How to screen out words related to products and eliminate invalid words accurately
Xiaobai learns MySQL - Statistical 'opportunism'
Upgrade PHP to php7 The impact of X (2), the obsolescence of mcrypt decryption
Bingbing's learning notes: implementation of circular queue