Currently the analyzers dont work when added to an asp.net 5 project.
I tried adding the nuget package to an asp.net 5 project. That added a reference under dependencies in the project.json file. The diagnostics do not trigger and I dont see a place to enalbe/disable analyzers.
Im not sure if analyzers are supported in asp.net 5 projects. The only thing I found was this issue(https://github.com/aspnet/Home/issues/196), but the issue is a bit old.
I think I fixed this by accident so I sent a pull request.
We're working with the roslyn team to come up with the convention. Install.ps1 files won't cut it for dnx projects.
@davidfowl Is there an issue in another GitHub repository I can link to so we can monitor progress on this?
Just tried this on an ASP.NET 5 project and it is not working. Just FYI, C# Essentials and Code Cracker for C# analyzers do work on the same ASP.NET 5 projects.
I also would love to see StyleCopAnalyzers working on ASP.NET 5 projects :)
Unfortunatly they cut the feature and it wont be in asp.net 5 rtm: https://github.com/aspnet/dnx/issues/2311 :disappointed:
https://github.com/dotnet/cli/issues/83 is closed and will be shipped with RC2 :tada:
:sparkles: Currently it is actually not that usefull. You can't specify a ruleset file and additional files are not supported as well. So stylecop.json does not work as well.
At least StyleCopAnalyzers with default settings will work? It's something... :smile:
It does!
So in RC2, we'll at least be able to specify analyzers in the project.json and have them run in the IDE - is my understanding correct?
What's the workaround in the meantime? Using StyleCop.Analyzers from a VSIX extension?
Any move on this issue?
There was some work done in the https://github.com/dotnet/cli repo and this should in .net core rc2
Is analysis still going to be expected to work in the coming RC2? Did it make it in?
I just tried it with the latest bits and it is working. Im probably going to write a short documentation page about how this is set up because it is not very intuitive and it needs some (small) workarounds to get the ruleset file and the config file working.
I created #2133 with the documentation.
Is there any move on this issue, since Microsoft announce that .net core will be officially release RTM on 6/27/2016 as stated here - https://github.com/dotnet/core/blob/master/roadmap.md?
Did you read the links above? Here's some documentation:
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/DotNetCli.md
I hope to hear from MS if the full experience including invoking code fixups, may make it into some VS '15.0' preview (VS 2016?).
I think tooling support is not part of RTM unfortunately.
Hi guys,
In my opinion the tooling is most important thing when you chose development platform. I have used VS about 10 years and missing a sopport of MS tool is a huge breaking change in MS policy. I want to hear you what adoption do you expect, when you do not follow your own principle.
Thanks guys for your support!
I am not an MS employee but I think their communication has been quite clear. The tooling is a "preview". That means "it works, but there are things that are not there yet". I am able to work without this feature, and while it's nice to have, it doesn't block me learning and building stuff.
Please excuse me. I am not complaining about style.cop but about tooling and this is major point to achieve a big adoption for your product. .net was mature and now is broken, which mean that .net is going on the same road as node.js, just marketing and what is next?
Any progress on this? I'm on the edge of deciding to go Core (.net framework) vs ASP.net 5 and having StyleCop not working is kind of a big deal.
UPDATE:
You can reference you .rules and stylecop.json file from your project.json file. See the answer on StackOverflow: http://stackoverflow.com/a/38094474/46810
@igatanasov for the record, JavaScript has had static analysis, JSLint, since 2002, 7 years before Node.js was released and 8 years before StyleCop hit the scene in 2010. I feel your frustration, but's not the rest of the community that's late to the game here.
sure @QueueHammer , thanks for support
@QueueHammer I agree, no quick fixes is a big deal.
What you can do in the meantime is build stylecop, and install the vsix. You will get quick fixes but no build errors. It's perhaps better than nothing?
I am very disappointed at the lack of support for analyzers in .net core. What's more it looks as if we will wait until studio 15 or beyond before its completed. I think they tried to boil the ocean with .net core...
I cannot find an open issue tracking this, between this https://github.com/dotnet/cli/issues/83 and this https://github.com/aspnet/dnx/issues/2145 which are both closed, yet there is no support for quick fixes. Is it being tracked anywhere?
Moreover I don't see any references to roslyn quick fixes in the release notes for studio 2017 RC
https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes
I just tried it in VS 2017 RC. With the move back to msbuild, analyzers and code fixes work in .net core projects!
Thanks for the update - have to say that's really great news...
On Fri, 18 Nov 2016 at 10:29 PM Dennis Fischer [email protected]
wrote:
I just tried it in VS 2017 RC. With the move back to msbuild, analyzers
and code fixes work in .net core projects!—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/806#issuecomment-261633885,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACb8qgXoK-kW9Omu7Wrk0LIOSLtfubJfks5q_gqOgaJpZM4EV1lv
.
It appears analyzers aren't supporting the newer csproj and xproj files in VS2017 RC completely. Pulling in StyleCop.Analyzers in as a Nuget reference and while StyleCop warnings/errors show up, I can't control them. Seems as though all rules are on regardless of settings in either a StyleCopRules.ruleset file or in the stylecop.json file.
Any chances this will be in the release in March? How does this affect VSTS build definitions employing MSBuild or dotnet build?
This is with .NET Core 1.1 projects at the least.
Figured it out! VS2017 isn't exposing the full properties editor for .NET Core class library CSPROJ files yet; but the settings are indeed supported. After adding Stylecop.Analyzers via NuGet, manually edit the .csproj file and add the desired Stylecop ruleset file to your CodeAnalysisRuleSet property (or add the property if it is missing entirely). Like so:
<PropertyGroup>
<CodeAnalysisRuleSet>..\..\_stylecop\StyleCopRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
Confirmed this is also working on command line with dotnet build thank goodness. So VS2017 is literally just not exposing the settings (or the Analyzer support for the project in the Analyze menu). Will likely check to see if this runs in VSTS on a CI build tomorrow or Monday.
/cc @srivatsn @davkean
Current "stock" VSTS (visualstudio.com) build agents do not have MSBuild v15 installed yet which is required to build .csproj files. So anyone looking to build .NET Core 1.1 .csproj projects will need to creat their own agent.
StyleCop.Analyzers itself appears to be working wonderfully and is simply waiting for related toolings like VSTS to catch up at this point.
Nice work guys.
Yes we didn't get to adding the code analysis property page yet. It's tracked by https://github.com/dotnet/roslyn-project-system/issues/266. As you've found setting the Ruleset property manually is the workaround. Hope to get to it soon.
@srivatsn there appears to be another quirk I've filed today on the CLI project (https://github.com/dotnet/cli/issues/5685); this is at the very edge of my experience with Roslyn and Core but there is definitely some form of inconsistency. Just not certain what half of the inconsistency is right, and what half is wrong.
Thank you all again.
This is fixed now according to some recent testing I did
Most helpful comment
Figured it out! VS2017 isn't exposing the full properties editor for .NET Core class library CSPROJ files yet; but the settings are indeed supported. After adding Stylecop.Analyzers via NuGet, manually edit the .csproj file and add the desired Stylecop ruleset file to your CodeAnalysisRuleSet property (or add the property if it is missing entirely). Like so:
<PropertyGroup> <CodeAnalysisRuleSet>..\..\_stylecop\StyleCopRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup>Confirmed this is also working on command line with
dotnet buildthank goodness. So VS2017 is literally just not exposing the settings (or the Analyzer support for the project in the Analyze menu). Will likely check to see if this runs in VSTS on a CI build tomorrow or Monday.