Stylecopanalyzers: [Question] .NET Core Support

Created on 29 Jun 2016  路  11Comments  路  Source: DotNetAnalyzers/StyleCopAnalyzers

Any plans to support .NET Core? I noticed when moving some code to a .NET Core Class project, the squiggles and analyzers didn't appear to work like before.

Is this a limitation on StyleCopyAnalzyers or being a preview in tooling? Or did I simply overlook something when setting up my project :smile:

.net core question resolved

Most helpful comment

This only generates the warnings during the build, but not in the IDE while developing.

All 11 comments

I just tried it on a fresh project with VS2015 update 3 and it seemed to generate warnings and apply code fixes as expected. I haven't worked out how you apply a ruleset file to a .Net Core project yet though.

Exactly. VS 2015 w/ Update 3 still works for me when working with something like a WPF app. It seems the current StyleCop version (v1) won't work with .NET Core projects. Lemme know if you find a fix.

So I dug around a little and it seems you can use a ruleset file by adding a reference to it to your global.json file. In the buildOptions section that you already likely have add additional arguments with a path to your ruleset. I didn't exhaustively test but it cleared up my numerous 'file requires header' warnings. Note the emitEntryPoint option was already there and isn't relevant.

"buildOptions": { "emitEntryPoint": true, "additionalArguments": [ "/ruleset:../../global.ruleset" ] },

This only generates the warnings during the build, but not in the IDE while developing.

I'm wondering if this is connected somehow?
https://github.com/dotnet/roslyn-project-system/issues/285

Same here: warnings are shown but no code fixes are available in Visual Studio 2015 Update 3.

Any update on when (if ever) code fixes will work with .net core and Visual Studio 2015? Thanks!

Code Fixes don't work in core projects in VS 2015. In VS 2017 RC where they switch back to msbuild however they do!

@pdelvo Is there any doc/guidance on how to setup a VS 2017 .NET Core project with StyleCop.Analyzers and configure it using a custom .ruleset file?

Was this page helpful?
0 / 5 - 0 ratings