前言

好的代码格式,有利于阅读和查错,慢慢的有利于养成良好的编码习惯,也可以帮我们找出一些低级错误。

StyleCop

在Nuget上搜索stylecop,选择MSBuild的那个版本,安装。

手动编辑.csproj文件

加入如下代码:

  <PropertyGroup>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>

格式检查

如果有错误,则项目build 失败。

因为using后面没有空格,直接跟着(,所以build失败:

const 声明在其他类型之后,build失败:

后记

强迫自己养成好的代码习惯,增加可读性,还可以排查一些低级的错误,也很美观。

不喜勿喷,每个人都有自己的习惯

Visual Studio 201~ Code 格式检查的更多相关文章

  1. how to build apache log4cxx 0.10 by Visual Studio 201*

    Chapter 1 Official Steps  We are going to follow the steps here, http://logging.apache.org/log4cxx/b ...

  2. ShortKey – Visual Studio/VS Code etc.

    Switching between .h and .cppIn Visual Studio 2013 and later :there is a default keyboard shortcut f ...

  3. visual studio 的 code snippet(代码片段)

    visual studio自带代码片段,用了6年visual studio才知道有这么个玩意……惭愧 最简单例子 for循环,for,连点两下tab……自己研究吧

  4. Visual Studio 调试系列5 检查变量(使用自动窗口和局部变量窗口)

    系列目录     [已更新最新开发文章,点击查看详细] 在调试时,“自动变量”和“局部变量”窗口会显示变量值. 仅在调试会话期间,这两个窗口才可用. “自动变量”窗口显示当前断点周围使用的变量. “局 ...

  5. Why do I keep getting mixed tabs and spaces in a Visual Studio C# code window?[vs power tools issue transfered]

    goto tools->option->power tools-> turn "use mixed tabs" option to off. you won`t ...

  6. [搬运] 将 Visual Studio 的代码片段导出到 VS Code

    原文 : A Visual Studio to Visual Studio Code Snippet Converter 作者 : Rick Strahl 译者 : 张蘅水 导语 和原文作者一样,水弟 ...

  7. Visualize Code with Visual Studio

    In this post, App Dev Manager Ed Tovsen spotlight the features and benefits of Code Maps in Visual S ...

  8. 开发 ASP.NET vNext 初步总结(使用Visual Studio 14 CTP1)

    新特性: vNext又称MVC 6.0,不再需要依赖System.Web,占用的内存大大减少(从前无论是多么简单的一个请求,System.Web本身就要占用31KB内存). 可以self-host模式 ...

  9. visual studio 的Error List 显示乱码

    复制到右键菜单如下: Severity Code Description Project File LineError 閿欒: 绋嬪簭鍖卌om.baidu.lbsapi.auth涓嶅瓨鍦? com. ...

随机推荐

  1. C#之委托和事件

    我想,读者们可能看过一部电影叫<全民目击>,在电影中,富豪林泰婚期将至,准新娘却惨死地下停车场,林泰的富二代女儿林萌萌成为最大嫌疑人,林泰不惜重金聘请国内顶级律师周莉为女儿辩护,而公诉方却 ...

  2. Binder和SurfaceFlinger以及SystemServer介绍-android学习之旅(79)

    由于binder机制的存在,使得进程A可以访问进程B中的对象. Android系统Binder机制中的四个组件Client.Server.Service Manager和Binder驱动程序: 1. ...

  3. 22_Android中的本地音乐播放器和网络音乐播放器的编写,本地视频播放器和网络视频播放器,照相机案例,偷拍案例实现

    1 编写以下案例: 当点击了"播放"之后,在手机上的/mnt/sdcard2/natural.mp3就会播放. 2 编写布局文件activity_main.xml <Line ...

  4. Bootstrap 简介: 创建响应式、移动项目的工具

    原文链接: Introduction to Bootstrap: A Tool for Building Responsive, Mobile-First Projects 下载: 示例代码Boots ...

  5. (视频)《快速创建网站》2.1 在Azure上创建网站及网站运行机制

    现在让我们开始一天的建站之旅. 本文是<快速创建网站>系列的第2篇,如果你还没有看过之前的内容,建议你点击以下目录中的章节先阅读其他内容再回到本文. 1. 网站管理平台WordPress和 ...

  6. Linux下MySQL备份以及crontab定时备份

    1. 备份某个数据库 ################################################################## # 备份某个数据库 ############ ...

  7. 报表软件公司悬赏 BUG,100块钱1个的真实用意

    上一篇文章我讲到,报表软件FineReport一反常态,做了个<提BUG,拿现金>的活动,1个BUG,100块钱.纵览软件行业,如金蝶用友浪潮IBM微软等国内外巨头,均没有这样的举动去征集 ...

  8. Sping--ApplicationEvent

    //让其他的应用事件继承它 public abstract class ApplicationEvent extends EventObject { /** use serialVersionUID ...

  9. 原生的zfs在rhel6上的安装

    原生的zfs在rhel6上的安装 ZFS(Zettabyte File System)作为一个全新的文件系统,全面抛弃传统File System + Volume Manager + Storage( ...

  10. LeetCode(51)- Count and Say

    题目: The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 11 ...