Skip to content

Instantly share code, notes, and snippets.

@brendanzagaeski
Created December 14, 2013 00:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save brendanzagaeski/7953966 to your computer and use it in GitHub Desktop.
Save brendanzagaeski/7953966 to your computer and use it in GitHub Desktop.
Fixing the Xamarin installation after uninstalling the "Xamarin Shell" extension from "Tools -> Extensions and Updates" in Visual Studio
If you uninstall the "Xamarin Shell" extension from "Tools -> Extensions and Updates" in Visual Studio, you will get a "'ShellPackage' package did not load correctly" error even after uninstalling and re-installing both Xamarin VS extensions.
## Cause
Uninstalling the "Xamarin Shell" from "Tools -> Extensions and Updates" sets a value on [1] named "Mono.VisualStudio.Shell,1.0", with the data:
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\COMMON7\IDE\EXTENSIONS\XAMARIN\SHELL\1.0.0\
[1] Computer\HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\ExtensionManager\PendingDeletions
Based on the label "PendingDeletions", it sounds like Visual Studio should remove the "Mono.VisualStudio.Shell,1.0" registry value once the "Xamarin Shell" extension has been uninstalled. But instead, as soon as this value is present, no amount of uninstalling and reinstalling Xamarin, restarting Visual Studio, or deleting things from the "%LOCALAPPDATA%\Microsoft\VisualStudio" directory can remove it.
As a consequence, although the Xamarin.Android installer successfully copies the "Xamarin Shell" into the Extensions directory, Visual Studio never registers it. For example, after the installation "Xamarin Shell" does not appear in the "Tools -> Extension and Updates" list, but Xamarin.Android does.
## Workaround / steps to repair the broken installation
Open `regedit` and delete the PendingDeletions -> Mono.VisualStudio.Shell,1.0 registry value. Then from an elevated command prompt run:
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" /setup /nosetupvstemplates
In my case that fixes the problem, so hopefully there's no need to re-install either of the Xamarin VS extensions.
## Full steps to reproduce
1. Uninstall the "Xamarin Shell" extension from "Tools -> Extensions and Updates".
2. Quit Visual Studio.
3. Uninstall both Xamarin.Android and Xamarin.iOS from the add/remove programs Control Panel.
4. Delete the "Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Xamarin" folder, if there is one.
5. Install Xamarin.Android.
6. Launch Visual Studio.
## Error messages
Here are some of the error messages. These seem to be all the same ones you would get if you accidentally deleted the "Extensions\Xamarin\Xamarin Shell" folder.
### From the dialog that pops up when Visual Studio is loading:
The 'ShellPackage' package did not load correctly.
The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\username\AppData\Roaming\Microsoft\VisualStudio\12.0\ActivityLog.xml'.
### From ActivityLog.xml
SetSite failed for package [ShellPackage]
The composition produced multiple composition errors, with 3 root causes. The root causes are provided below. Review the CompositionException.Errors property for more detailed information.
----
The 3 root causes are all "No exports were found that match the constraint", one each for these three ContractNames:
> ContractName Mono.VisualStudio.Extension.Commands.ICommandManager
> ContractName Mono.VisualStudio.Extension.Events.IShellEvents
> ContractName Mono.VisualStudio.Extension.Diagnostics.IUserMessageService
@puzit
Copy link

puzit commented May 28, 2015

Thanks Brendan.. fix heped me.

@aktivo
Copy link

aktivo commented Feb 10, 2016

Thanks

@jollescott
Copy link

Thank You Helped Alot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment