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.
[UninstallRun]entry as such. I would setFilename: "{app}\MyExtension.vsix", removeWorkingDir, strip out the"{code:uninstallVsix}"string (since it is badly written, and you should either execute from[Code]or from[UninstallRun], not both), and if you are missing permissions I would try to removerunascurrentuserflag. So it would become justFilename: "{app}\MyExtension.vsix"; Parameters: "/q /a /u"; Flags: shellexec. But, it's just a wild guess :-) - TLama