How do I perform a thorough uninstall for Xamarin for Visual Studio?

  1. 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
  2. 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

  3. 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.

  4. 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

  5. Open the registry editor (regedit).

  6. Look for the following key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\SharedDlls

  7. Find and delete any entries that match this pattern:

    C:\Program Files*\Microsoft Visual Studio 1*.0\Common7\IDE\Extensions\Xamarin

  8. Look for this key:

    HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\1*.0\ExtensionManager\PendingDeletions

  9. 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

  10. Open an administrator cmd.exe command prompt, and then run the devenv /setup and devenv /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
    
  11. Reboot.

  12. 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.

  1. Create a new Windows user account.

  2. Check if the Xamarin Visual Studio extensions load without error for the new user.

  3. 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 regeditHKEY_CURRENT_USER\Software\Microsoft\VisualStudio\1*.0
    • In regeditHKEY_CURRENT_USER\Software\Microsoft\VisualStudio\1*.0_Config
  4. If those stored settings do indeed appear to be the problem, you can try backing them up and then deleting them.