Visual Studio 201~ Code 格式检查
前言
好的代码格式,有利于阅读和查错,慢慢的有利于养成良好的编码习惯,也可以帮我们找出一些低级错误。
StyleCop
在Nuget上搜索stylecop,选择MSBuild的那个版本,安装。
手动编辑.csproj文件
加入如下代码:
<PropertyGroup>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>
格式检查
如果有错误,则项目build 失败。
因为using后面没有空格,直接跟着(,所以build失败:

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

后记
强迫自己养成好的代码习惯,增加可读性,还可以排查一些低级的错误,也很美观。
不喜勿喷,每个人都有自己的习惯
Visual Studio 201~ Code 格式检查的更多相关文章
- 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 ...
- ShortKey – Visual Studio/VS Code etc.
Switching between .h and .cppIn Visual Studio 2013 and later :there is a default keyboard shortcut f ...
- visual studio 的 code snippet(代码片段)
visual studio自带代码片段,用了6年visual studio才知道有这么个玩意……惭愧 最简单例子 for循环,for,连点两下tab……自己研究吧
- Visual Studio 调试系列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 ...
- [搬运] 将 Visual Studio 的代码片段导出到 VS Code
原文 : A Visual Studio to Visual Studio Code Snippet Converter 作者 : Rick Strahl 译者 : 张蘅水 导语 和原文作者一样,水弟 ...
- Visualize Code with Visual Studio
In this post, App Dev Manager Ed Tovsen spotlight the features and benefits of Code Maps in Visual S ...
- 开发 ASP.NET vNext 初步总结(使用Visual Studio 14 CTP1)
新特性: vNext又称MVC 6.0,不再需要依赖System.Web,占用的内存大大减少(从前无论是多么简单的一个请求,System.Web本身就要占用31KB内存). 可以self-host模式 ...
- visual studio 的Error List 显示乱码
复制到右键菜单如下: Severity Code Description Project File LineError 閿欒: 绋嬪簭鍖卌om.baidu.lbsapi.auth涓嶅瓨鍦? com. ...
随机推荐
- R-- Dplyr包
Dplyr 包应用 1. 筛选 filter() 按照给定的逻辑判断选择出合适的数据子集 fliter(data,year==2015,month==1) 支持对同一对象的任意条件组合 fliter( ...
- HibernateTemplate 查询原生sql及ljava.lang.object cannot be cast to
/** * 使用sql语句进行查询操作 * @param sql * @return */ public List queryWithSql(final String sql){ List list ...
- 推荐大家在GitHub 上值得关注学习的 iOS 开源项目
GitHub上有很多不错的iOS开源项目,和大家特别推荐以下几个项目: 1. ReactiveCocoa GitHub链接:ReactiveCocoa/ReactiveCocoa GitHub自家的函 ...
- Linux 内核配置机制(make menuconfig、Kconfig、makefile)讲解
前面我们介绍模块编程的时候介绍了驱动进入内核有两种方式:模块和直接编译进内核,并介绍了模块的一种编译方式--在一个独立的文件夹通过makefile配合内核源码路径完成 那么如何将驱动直接编译进内核呢? ...
- RPi Kernel Compilation
Overview This page explains how to rebuild the kernel image for the RPi. There are two possible rout ...
- iOS9 ReplayKit录制视频
猴子原创,欢迎转载.转载请注明: 转载自Cocos2Der-CSDN,谢谢! 原文地址: http://blog.csdn.net/cocos2der/article/details/50260873 ...
- Nginx的内部(进程)模型
nginx是以多进程的方式来工作的,当然nginx也是支持多线程的方式的,只是我们主流的方式还是多进程的方式,也是nginx的默认方式.nginx采用多进程的方式有诸多好处. (1)nginx在启动后 ...
- warning: implicit declaration of function 'getMyfilename' [-Wimplicit-function-declaration]|
我在main后面定义了getMyfilename()函数,然后就报出这个warning. 在main前声明一下就好了.
- db2字段修改
db2表字段修改 1:删除字段非空属性alter table XXX alter column XXX drop not null 2:添加字段非空属性alter table XXX alter co ...
- convert sorted list to binary search tree(将有序链表转成平衡二叉搜索树)
Given a singly linked list where elements are sorted in ascending order, convert it to a height bala ...