When launching VSIXInstaller.exe from our application, we're trying to use the ExitCode property on the Process object to determine if the package was successfully installed, but we've found that the exit code is 0 even if the user clicks the 'Cancel' button on the dialog.
I expected that there would be some other code returned in that scenario, similar to what msiexec does.
However, when I searched for documentation about the exit codes VSIXInstaller uses, I don't find anything. I'm looking for something along these lines.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With