I am currently doing research to complete my org's migration to VS 2015, including implementing StyleCop.Analyzers, getting ReSharper settings updated and checked into source control, etc.
One topic I keep coming across is "compatibility" between StyleCop and ReSharper. A Jet Brains dev has even forked classic StyleCop in order to make it "compatible" with ReSharper 9.
What does "compatible" mean here? Is it as simple as making all of ReSharper's default code analysis settings match those in StyleCop, or something more involved?
Our upgrades/changes include:
Visual Studio 2010 to 2015
ReSharper 8 to 10
StyleCop classic to StyleCop.Analyzers
... so I just want to make sure I have my bases covered.
Is it as simple as making all of ReSharper's default code analysis
settings match those in StyleCop, or something more involved?
Yes, pretty much. It's all about keeping the rules in sync so that one doesn't flag an error the other is ignoring.
One thing to watch for on this migration is the version of the R# plugin. I haven't had much joy with ReSharper.StyleCop, but
StyleCop by JetBrains 4.8 works fine, plus it is designed to "play nice" with
StyleCop.Analyzers.
Related
I'm toying with getting our team and projects ready for VS 2019. Right away, trying to set up Code Analysis for a new project, I find this:
So, if this is deprecated (and apparently can't even be used, so I'm thinking "deprecated" really means "gone"), where are we supposed to set up our Rule Sets? Is there some other location, or perhaps an altogether new solution to the problem of style and code quality?
Going forward, static analysis will be provided by Roslyn analyzers: https://github.com/dotnet/roslyn-analyzers
Migrate from FxCop code analysis to .NET compiler platform analyzers
Microsoft IntelliCode looks great!
We have a large solution (112 projects) in VS2013 Ultimate.
I love the Code Map feature, however when I am dragging types onto a Code Map dgml it insists on building the solution - even though I have not made any changes.
I can't see many options for this great feature, but is there anyway to tell it to stop building the solution everytime I add a type to the diagram?
This is a known issue and major complaint with Code Map in Visual Studio 2013. It affects certain types of projects (like ASP.NET ones) more than others because these projects always report that they have changes and need to be rebuilt.
The experience is improved in Visual Studio 2015 Enterprise, as we have added a "skip build" option.
We've made many improvements to CodeMap in Visual Studio 2015, so it's definitely worth getting it if you use Code Maps. Note that you can install VS 2015 along side VS 2013, so you don't have to migrate projects etc.
I see the code map document window in VS 2015 now contains a button labelled "Skip Build" which seems to solve this problem
We have a big legacy solution (170+ projects) and want to:
Perform initial code cleanup automatically for all our codebase with rules defined by us.
Have plugin available to integrate with ReSharper, so that we could see warnings/hints/suggestions in code and apply quick fixes with Ctrl + Enter.
Have config in source control, so it can be shared between all team members and coding style checked by TeamCity after every commit.
The best what we found for this is to use R# + StyleCop for this, but I recently found out that there are many more rules for code quality used by FxCop and Visual Studio - Microsoft Code Analisys Rule set:
http://msdn.microsoft.com/en-us/library/dd264925.aspx
StyleCop rule set is not compatible with it. We would prefer following Microsoft rule set, not StyleCop one.
Question: is there a way to integrate Microsoft rule set (customized) into ReSharper and have all three above - cleanup, quick fixes, TeamCity integration with Microsoft rules? After a day of googling I did not find how to do it. Can anyone suggest?
I believe this should be achievable in resharper now.
ReSharper allows you to configure an extensive set of formatting rules and enforce them in your code. These rules are applied when ReSharper produces new code with code completion and code generation features, code templates and refactorings. The formatting rules can be also applied to the existing code in the current selection, current file, or in a larger scope up to the entire solution.
Source: Jetbrains Resharper Help
In Visual Studio is there an automatic way to search over file(s) and find all classes/properties/methods that aren't referenced. Essentially abandoned code.
I don't want to manually have to right click on each and select "Find All References"
This is not a feature of Visual Studio in the current version. Using Roslyn you could code and Inspector yourself, but Roslyn doesn't offer one out of the box either at the moment. The walk-through on Semantic analysis should get you started. The roslyn forum is a good place to seek help or find examples, and there's a well monitored tag on StackOverflow as well of course.
Productivity plugins like Resharper and Code Rush offer this for sure. There are other similar tools that might have this feature JustCode, VisualAssist, CodeItRight are likely candidates.
You can also use something like Visual NDepend to detect unused methods. Their new command Linq to Code features should make it relatively easy to build a commandline tool that fishes out all unused calls.
A bit late but if you install SSDT (Sql Server Data Tools) this also add grayed reference count to each method in visual studio.
Note: This is actually "code lens" which is no longer available for VS2015. Installing the SSDT is the way you can have "code lens" in VS2015.
We're using Visual Studio 2010 (Premium edition if it matters), and pretty happy with it. However, We're never going to use the TFS features that's included in the IDE. (We're using Jira and Subversion, as it's not just Visual Studio that we work with, but also IntelliJ and a couple other IDE's.)
Is there any way to disable the TFS portions of the IDE? It's not a big deal or anything, just for the sake of "keeping things neat."
In Visual Studio 2010, go to Tools->Options In the list, select Source Control. Set your Current source control plug-in: to None
The main "TFS" parts of the IDE are in Team Explorer - Just don't install it.
Anything else you don't want/use, I'd advise you to simply ignore - VS has support for hundreds or even thousands of different things that you will probably never use, and you can't easily "clean" them all away.
In my experience the more you alter your installation of Visual Studio the more problems you will have with it. Every custom Option you set is another thing you have to repeatedly set every time you get a new PC or install a new VS. (Although it has improved a lot since import/export options became available and reliable). I used to spend about half a day setting up a visual studio to "work well", and now I just install it and use it. Ultimately I found that it was easier to just adjust my working practices (e.g. by relearning a few keyboard shortcuts etc) than to try to bend VS to my will.