VS Refactoring Essentials (formerly) NR6Pack - Free analyzers and refactoring for Visual Studio 2015
There are some amazing free and open source C# and VB.NET analyzers and refactorings that you can download and use now in Visual Studio 2015. Formerly called "NR6Pack" they have now be renamed VS Refactoring Essentials, a nice nod to VSWebEssentials I must say.
The best part, of course, is that since the Visual Studio Community Edition is not only FREE but also now supports extensions, that any open source or indie developer can get pack some serious power into their Visual Studio installations.
There's some interesting history here as the project and its core technology has been around for a while. It's moved from SharpDevelop into NRefactory, then NRPack, and now with the major Roslyn refactor by Mike Krüger, you've got a nice Roslyn code-base and a free extension for all called VS Refactoring Essentials.
There's lots of great refactorings, too many to include screenshots for all of them, but here's a few favorites.
Sometimes you'll dig deep into a dictionary without being defensive. VS Refactoring Essentials will notice and check the dictionary key first. Note that you'll always get a preview of what it's going to change first!
Conditionals can sometimes get away from you. VS Refactoring Essentials will simplify common conditionals and make them easier to read.
When setting boolean flags you'll sometimes set it, check something, and update that same flag. This refactoring will notice that and do it all on one line for you.
I never get ?: and ?? correct. VS Refactoring Essentials will help you move between ternary operators and null coalescing.
FYI - This is a purely open source project that is not affiliated with Microsoft. It's part of the SharpDevelop OSS project and is MIT-licensed. Big thanks to the SharpDevelop team!
NOTE: Visual Studio 2015 will launch on July 20th. Be sure to download Visual Studio 2015 Community on that date. Until then, the V2015RC of Community is here.
Be sure to follow @VSRefactoring on twitter and thanks for them for their hard work and community focus! Go download Refactoring Essentials here for VS2015. Report issues on their GitHub.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
This is the most important feature IMHO as this was the reason why I went ahead to VS Professional right away.
Community Edition is SO AWESOME (saves me from the VS2015 "msdn required" apocalypse). I will however stick to CodeRush from Developer Express.
CodeMaid is also a nice and free extension for refactoring and code analysis. I've been using it for several months and I'm quite happy with it.
Any experience if this could really replace resharper?
Are there any very good reasons to stay on resharper?
private _myPrivateField;
public void MyPascalCaseMethod()
Does this do the same?
Thanks
In the case of 3, would o != 10 be worse for the compiler than o < 10 || o > 10 (either way, that's a really cool intent deciphering bit of code)?
That ?? vs ? one would probably run roughshod over my code over various projects at work. Honestly, didn't know about ?? but I've used that same style of check all over the place. Nice to know, thanks.
https://github.com/icsharpcode/RefactoringEssentials/issues/26
1. The result isn't DRY. The key is repeated in the `ContainsKey` call and the call to the dictionary indexer. This opens the door to bugs if one instance of the key is changed but not the other. Additionally, the cost of evaluating the key is doubled, which may be significant if not a simple literal.
2. Two dictionary lookup are required. Instead, the refactoring should generate `TryGetValue`.
3. The refactored code assumes that the proper response to a missing key is to do nothing. Somethings this is correct, but often not. Just as generated code for methods includes `throw new NotImplementedException()`, this refactoring should include code to throw an exception, which the user can replace with the appropriate handling logic or remove as appropriate.
@Marina - We want VB 7.0 !
@Niklas - I'm glad this will probably kill off re-sharper, I don't like it for a myriad of reasons:
1. Expensive.
2. Need to re-purchase for each version of VS.
3. Developers develop a perceived dependence on it - ie they think they can't code without it.
4. Generally - I've not found it useful, I've seen it duplicate code all over a project (the Nullable<T> routine it seems to add to every controller).
5. Developers mostly don't understand it, it just makes their code look a bit more "pro" where pro = slightly unreadable.
6. Refactoring tools should support, not take control.
@Robert - Agreed, maybe a textbox explaining the change would be of massive help.
@Max - I hear you partner!
@Edward Brey - you've submitted it to their github, you don't need to advertise here.
Peace.
VisualSmarter.blogspot.com
Comments are closed.
But I feel like you should also mention this project as well.
https://github.com/DotNetAnalyzers
The Style Cop ones are especially nice since the ReSharper StyleCop plugin has never been open sourced by the maintainer.