在ASP.NET Core项目上启用StyleCop.Analyzers [英] Enabling StyleCop.Analyzers on ASP.NET Core projects

查看:192
本文介绍了在ASP.NET Core项目上启用StyleCop.Analyzers的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我在线阅读的文档,您需要做的就是将以下内容添加到project.json中的依赖项:

According to the docs I've read online all you need to do is add the following to the dependencies in project.json:

  "version": "1.0.0-*",

  "dependencies": {
    "DependencyA": "1.0.0-*",
    "DependencyB": "1.0.0-*",
    "StyleCop.Analyzers": {
      "version": "1.0.0",
      "type": "build"
    }
  },

  "frameworks": {
    "net46": { }
  }

(其中DependencyADependencyB是来自同一解决方案的两个.NET Core项目) 然后StyleCop.Analyzers将在构建项目时使用默认规则集运行.没有.我没有收到任何警告,也很确定,目前的代码违反了很多规则.有人成功完成了这项工作吗?

(where DependencyA and DependencyB are two .NET Core projects from the same solution) and then StyleCop.Analyzers will run with the default rule set upon building the project. It doesn't. I get no warnings or anything and I'm pretty sure the code at the moment violates a lot of rules. Did anyone successfully get this working?

推荐答案

我的.NET Core版本显然太旧了.升级到最新版本后,现在可以使用了.

My .NET Core version was apparently too old. After upgrading to the latest one it now works.

这篇关于在ASP.NET Core项目上启用StyleCop.Analyzers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆