Search Sreeni's Insights

Filter by content type
crafting December 19, 2019 5 min read

ReSharper guidelines: installation, license, code coverage and troubleshooting - Part 4

The ReSharper best practices, how to install it and activate the license, the dotCover must-dos and how to troubleshoot the slowness.

Share:

ReSharper guidelines: installation, license, code coverage and troubleshooting - Part 4

A guideline is only useful when the developer can follow it on day one. Most of the questions we get are not about the rules, they are about the basics, how to install the tool, how to activate the license, what is mandatory and what to do when Visual Studio becomes slow. In the previous articles, we discussed why we need ReSharper, what it is and how the code style rules are enforced in the build. In this article, we are going to see the quick summary of the guidelines, how to install ReSharper and dotCover, how to activate the license, and how to deal with the slowness.

TL;DR Summary

  • The infrastructure team automates the ReSharper installation for developer machines through the configuration management system. Install it manually only when needed.
  • Install ReSharper and dotCover from the ReSharper Ultimate installer. dotPeek, dotTrace and dotMemory are optional.
  • Activate the license from the license server, and ensure all installed products show the green tick mark.
  • Install the code style enforcement policy to all your Visual Studio solutions, and clean all the validation errors before the build.
  • Use dotCover during the C# development, and enable its continuous testing during the local build.
  • When Visual Studio is slow with ReSharper, follow the JetBrains troubleshooting and speed up guides.

Best Practices

Find below the quick summary of the ReSharper best practices which must be implemented by all the developers. You can find more details on how to implement in the further sections of this article.

Code style:

  • Must have ReSharper installed on your machine.
  • Must install the code style enforcement policy to all your Visual Studio solutions.
  • Must include the ReSharper team shared settings file in source control.
  • Must clean all the ReSharper code style validation errors and warnings before the build.
  • Cleaned code should work as expected, without impacting the functionality.

Code coverage:

  • Must use dotCover during the C# development.
  • Must enable the continuous testing feature of dotCover during the local Visual Studio build.

How to install ReSharper?

The infrastructure team automates the ReSharper installation for all developers’ machines through the configuration management system. In case you want to install it manually, follow the following steps,

  • Download the ReSharper Ultimate installer from the JetBrains download page.
  • Close all running instances of Visual Studio.
  • Run the downloaded installer, it will display the installer window.
ReSharper installer window
ReSharper installer window
  • Select the ReSharper and dotCover products. The dotPeek, dotTrace and dotMemory are optional.
Select ReSharper and dotCover products
Select ReSharper and dotCover products
  • Click on the license agreement checkbox, then click on Next.
  • It will bring the Products to Install summary page, here click on Install to start the installation process. It installs the ReSharper plugin to the selected versions of Visual Studio.
  • Once all items are installed successfully, it will show the installation completed screen. Click on Exit to close the installer window.
  • The next step is the license activation. Refer the installation guide for more information.

How to activate the license?

Follow the following instructions to activate the ReSharper license,

  • Open Visual Studio. You will be able to see the ReSharper menu now. For Visual Studio 2017 or less, it is a top level menu, and for Visual Studio 2019 you will see it under the Extensions menu.
  • Go to ReSharper → Help → License Information menu.
ReSharper Help License Information menu
ReSharper Help License Information menu
  • It will bring the license information dialog box. Click on the Use License Server checkbox, it automatically takes you to the manage license server screen.
  • Enter the license server address given by your infrastructure team (for example http://<license-server>:8080) in the Server address textbox.
  • As soon as you enter the address, it will verify the server and show the status as Ok with a green tick mark at the right bottom of the textbox.
  • Click on the Add button to save the license information, and then click on the Close button. It will take you to the license summary screen.
  • Choose the newly added license server from the Use License Server list.
  • Please ensure you got the green tick mark for all the installed products, then click on the Ok button to close the dialog box.

Just to pulse check, now you should be able to see all the ReSharper feature menus in Visual Studio.

The following diagram summarizes the whole setup for a developer,

Steps to set up ReSharper for a developer
Steps to set up ReSharper for a developer

How to use dotCover as per the guidelines?

You must use dotCover during C# development. The main purpose is risk identification, the more code is covered by tests, the safer it is to change the code. It is mandatory to enable the continuous testing feature of dotCover during the local Visual Studio build, so you can see the impact of your change on the tests immediately. Refer the continuous testing documentation to enable it.

Info: Keep in mind that the code coverage tells how much testing you are doing, not how well you are doing it. Use it as a guide, don’t use it as a target to chase.

How to troubleshoot the slowness of ReSharper?

ReSharper slowness in Visual Studio is a known issue. JetBrains has provided a troubleshooting guide, and you can find it here. In addition to that, you can find the speed up guidelines here. Go through them before you disable ReSharper, because the enforcement policy needs it.

Wrap up

In this article, we have looked at the quick summary of the guidelines, how to install ReSharper and dotCover, how to activate the license, and how to troubleshoot the slowness. Over the four articles, we covered why we need ReSharper, what it is, how the rules are enforced in the build, and the setup guidelines. I hope this series provided you some insights into improving the code quality with ReSharper. Thanks for reading these articles.

Related Posts