How do I perform a thorough uninstall for Xamarin for Visual Studio?
From the Windows Control Panel, uninstall any of the following that are present:
- Xamarin
- Xamarin for Windows
- Xamarin.Android
- Xamarin.iOS
- Xamarin for Visual Studio
In Explorer, delete any remaining files from the Xamarin Visual Studio extension folders (all versions, including both Program Files and Program Files (x86)):
C:\Program Files*\Microsoft Visual Studio 1*.0\Common7\IDE\Extensions\Xamarin
Delete Visual Studio's MEF component cache directory as well:
%LOCALAPPDATA%\Microsoft\VisualStudio\1*.0\ComponentModelCache
In fact, this step by itself is often sufficient to resolve errors such as:
"The 'XamarinShellPackage' package did not load correctly"
"The project file ... cannot be opened. There is a missing project subtype"
"Object reference not set to an instance of an object. at Xamarin.VisualStudio.IOS.XamarinIOSPackage.Initialize()"
"SetSite failed for package" (in Visual Studio's ActivityLog.xml)
"LegacySitePackage failed for package" (in Visual Studio's ActivityLog.xml)
(See also the Clear MEF Component Cache Visual Studio extension. And see Bug 40781, Comment 19 for a bit more context about the upstream issue in Visual Studio that can cause these errors.)
Also check in the VirtualStore directory to see if Windows might have stored any overlay files for the Extensions\Xamarin or ComponentModelCache directories there:
%LOCALAPPDATA%\VirtualStore
Open the registry editor (
regedit
).Look for the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\SharedDlls
Find and delete any entries that match this pattern:
C:\Program Files*\Microsoft Visual Studio 1*.0\Common7\IDE\Extensions\Xamarin
Look for this key:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\1*.0\ExtensionManager\PendingDeletions
Delete any entries that look like they might be related to Xamarin. For example, here's one that used to cause trouble in older versions of Xamarin:
Mono.VisualStudio.Shell,1.0
Open an administrator
cmd.exe
command prompt, and then run thedevenv /setup
anddevenv /updateconfiguration
commands for each installed version of Visual Studio. For example, for Visual Studio 2015:"%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" /setup "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" /updateconfiguration
Reboot.
Reinstall the current stable version of Xamarin using from visualstudio.com.
Additional troubleshooting steps for "package did not load correctly"
In cases where the above steps do not resolve the "package did not load correctly" error, here are a few more steps to try.
Create a new Windows user account.
Check if the Xamarin Visual Studio extensions load without error for the new user.
If the extensions load correctly, then the problem is most likely caused by some of the stored settings for the original user:
- In Explorer – %LOCALAPPDATA%\Microsoft\VisualStudio\1*.0
- In regedit – HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\1*.0
- In regedit – HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\1*.0_Config
If those stored settings do indeed appear to be the problem, you can try backing them up and then deleting them.