I am using inno setup to install a visual studio extension that my group created. It installs just fine but I am having trouble uninstalling it through inno setup. As it is now, the user has to manually uninstall it through Visual Studios. This is the code that should install and uninstall the vsix file:
[Files]
Source: "MyExtension.vsix"; DestDir: "{app}"; AfterInstall:installVsix; Flags: ignoreversion recursesubdirs createallsubdirs
[UninstallRun]
Filename:"MyExtension.vsix"; WorkingDir: "{app}"; Parameters:"/q /a /u""{code:uninstallVsix}"; Flags: shellexec runascurrentuser
[Code]
procedure installVsix();
var
ErrorCode: Integer;
begin
if not ShellExec('', ExpandConstant('{app}\MyExtension.vsix'), '/q /a /i', '', SW_SHOW, ewNoWait, ErrorCode) then
begin
// handle failure if necessary
end;
end;
function uninstallVsix(parameters:String): String;
var
ErrorCode: Integer;
begin
ShellExec('', ExpandConstant('{app}\MyExtension.vsix'), parameters, '', SW_SHOW, ewNoWait, ErrorCode)
Result:=''
end;
Right now I am getting the following error when I uninstall the program: Path to vsix file 'the path.vsix' is invalid or you don't have required access permissions. Please check the path is valid and you have required access permissions.
I know that the path was valid before uninstalling.. I'm not sure if the problem is that the file is being uninstalled before the VsixInstaller is able to run and if that is the problem then I don't know how to fix it.
I'm really new to Inno Setup and I'm really not sure how to do this.
.Vsix are installers, so you are using an InnoSetup installer to install the installer, which is weird.
.Vsix files are associated to the .vsix installation tool, named VSIXInstaller.exe (in folder C:\Program Files (x86)\Microsoft Visual Studio <version>\Common7\IDE). When installed, the extension inside the .vsix is copied to a random folder by VS (in folder C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\<version>\Extensions) to avoid collisions with other extensions. Notice that once the extension is installed, its .vsix installer file could be deleted!
To uninstall a .vsix-based extension you use the vsix installation tool with the /u flag (there are other flags for quiet, etc.) and the identifier of the extension:
VSIXInstaller.exe /u:{VSIXIdentifier}