These exit codes come from various inheritors of the Microsoft.VisualStudio.ExtensionManager.ExtensionManagerException
class:
1001 ExtensionManager.AlreadyInstalledException
1002 ExtensionManager.NotInstalledException
1003 ExtensionManager.NotPendingDeletionException
1005 ExtensionManager.IdentifierConflictException
1006 ExtensionManager.MissingTargetFrameworkException
1007 ExtensionManager.MissingReferencesException
1008 ExtensionManager.BreaksExistingExtensionsException
1009 ExtensionManager.InstallByMsiException
1010 ExtensionManager.SystemComponentException
1011 ExtensionManager.MissingPackagePartException
1012 ExtensionManager.InvalidExtensionManifestException
1013 ExtensionManager.InvalidExtensionPackageException
1014 ExtensionManager.NestedExtensionInstallException
1015 ExtensionManager.RequiresAdminRightsException
1016 ExtensionManager.ProxyCredentialsRequiredException
1017 ExtensionManager.InvalidPerMachineOperationException
1018 ExtensionManager.ReferenceConstraintException
1019 ExtensionManager.DependencyException
1020 ExtensionManager.InconsistentNestedReferenceIdException
1021 ExtensionManager.UnsupportedProductException
1022 ExtensionManager.DirectoryExistsException
1023 ExtensionManager.FilesInUseException
1024 ExtensionManager.CannotUninstallOrphanedComponentsException
1025 ExtensionManager.CorruptInstanceException
1026 ExtensionManager.RunFromEnginePathLocationException
2001 VSIXInstaller.InvalidCommandLineException
2002 VSIXInstaller.InvalidLicenseException
2003 VSIXInstaller.NoApplicableSKUsException
2004 VSIXInstaller.BlockingProcessesException
2005 VSIXInstaller.UserCancelledException
3001 means any other exception.
P.S. To escape the situation of getting the zero exit-code when a user clicks "Cancel", use silent installation (/quiet
flag in the command line) if it is appropriate in your scenario.
Edit: As of Visual Studio 2017 15.7, VSIXInstaller returns the exit code of 2005 if the user cancels the installation.