Tudor Tudor - 1 month ago 17
ASP.NET (C#) Question

Enabling StyleCop.Analyzers on ASP.NET Core projects

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": { }
}


(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?

Answer

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

Comments