Updating Xamarin.Forms using Nuget when Resharper is installed

Nuget is the direction that may developers, including Xamarin, are moving as far as pushing components into solutions written using Visual Studio or Xamarin Studio.

I have a love/hate relationship with Nuget.  When it works, it works great.  When it doesn’t work, it is worse than the DLL Hell we used to endure way back when.

The Xamarin.Forms team ships updates to their component on a fairly regular basis and I always dread attempting to apply an update because I use Resharper, which seems to cause all types of issues when installing certain packages.

I am totally unsure if it is Resharper, Visual Studio, Nuget, Xamarin, or Xamarin.Forms which have the issues, but you can totally break your solution and have to deinstall and reinstall all of your components from scratch.  At least that has been my experience, on my main development machine using Visual Studio 2013.

 

A Solution

@ChaseFlorell gave a really great answer to a question on the Xamarin.Forms forum yesterday regarding the proper update procedure if you have Resharper installed. He gave me permission to document it here.

 

Step 1: Disable Resharper

Run this command in the Visual Studio Command Window:

Resharper_Suspend

This can also be accomplished by selecting:

Tools, Options, ReSharper, Suspend Now

 

Step 2: Open the Nuget Package Manager Console.

Tools, Nuget Package Manager, Package Manager Console.

Step 3: Install Xamarin.Forms updates

Run the command:

Get-Project -all | Install-Package Xamarin.Forms

Note: This process may require you to reboot Visual Studio. If so, then save your solution when prompted so that the changes Nuget made are recorded.

 

Step 4: Verification

I always like to verify that the process worked correctly, which you can do by opening the Nuget Package Manager:

Tools, Nuget Package Manager, Manage Nuget Packages for Solution

Click on the Installed packages node and review the version number of Xamarin.Forms to make sure it updated properly.

 

Step 5: Re-enable Resharper

Back in the Command window, run this command:

Resharper_Resume

This can also be accomplished by selecting:

Tools, Options, ReSharper, Resume

 

Final Thoughts

While this process looks, and should be, fairly simple, it may not be.

I was updating one of my projects as I was writing this article and even after restarting Visual Studio when told to do so, I still get the message that I need to restart Visual Studio to complete the reinstallation process – no matter how many times I restarted.

So, in summary, the above technique should work for most people, but when it doesn’t then you need to be prepared to complete the steps manually.

And keep in mind that I have had to actually remove all of the Xamarin.Forms packages from my solution and reinstall them from scratch to get them to reinstall properly.

That may be just me and my machine so your experience may vary.

Leave a Reply 0 comments