Disabling ReSharper to speed up Nuget Updates

ReSharper is one of the best development tools I have ever come across. It is enabled by default whenever I work in Visual Studio. It also happens to be a bit of a monster when it comes to consuming resources. This means there are rare times I wish to turn it off.

In my team we have a few different products that we rotate between. This means there is a lot of common code we have to share between the projects. We used to have a shared folder that contained all the assemblies from the shared code. It was messy and meant we were unable to version the code. We eventually migrated to Nuget packages.

This solution is a much better one and means we now have versioning and has lead to a much more maintainable code base. There are daily changes to the shared code base and this means that there are always Nuget packages to update.

Nuget updates the packages sequentially and doesn't offload the project or freeze the extensions. Once it has finished updating a file it saves it. ReSharper rebuilds its own cache whenever a file is change. This combination is a lethal one as a typical Nuget package update changes 3 files. This means that if, like us, you have 20 packages that have changed Resharper is going to try and rebuild its cache 60 times. This results in a 3 minute Nuget update taking a good 30 minutes. It wastes time and is very unproductive. We disable ReSharper when doing Nuget package updates.

Disabling ReSharper

Now being the lazy developer I am this was too much effort. I decided to extend our existing Visual Studio extension we had developed internally. ReSharper does provide a Visual Studio Command for this very purpose and this meant it was not very hard to implement. It took me all of 30 minute to implement and redistribute.
We now have wonderful menu item that means in two clicks I can toggle ReSharper off or on.
The relevant code snippet to do this is below: