1

I have Inno Setup installer (written before me) which extracts a set of VSTO files and starts VSTO MS Office addin installation then. It has a problem that upon extracting VSTO files into a temp folder and launching VSTOInstaller.exe it immediately displays Finish button. If the user clicks it, temporary files are deleted and starting the actual installation of VSTO addin in VSTOInstaller then results in "file not found" errors. I'm supposed to fix that (ideally, to have Finish button in Inno Setup installer appear only when VSTOInstaller spawned by it has finished execution).

VSTO package itself (a collection of "Application Files" folder, setup.exe and .vsto file) is created by ClickOnce Publish tool in Visual Studio. The package is digitally signed, etc.

I tried various options:

  • To not finish the Inno Setup installation until the process which opens .vsto file finishes (with waituntilterminated flag). Doesn't work, seems the process changes during opening the .vsto file, VSTOInstaller isn't the first process in the chain. Thus, Inno Setup waits only for the process which quickly passes execution to another process (VSTOInstaller) and then shuts down.
  • To not remove extracted files upon the installation (with uninsneveruninstall flag). Looks like it only works for uninstallation while removing temp files during the installation is somewhat different. I didn't find any way to keep the unpacked files intact after finishing the installation.

Currently .iss file looks like:

;---------------------------------------------------------------------
[Setup]
AppName=Outlook Addin
AppVerName=Outlook Addin 2.0
DefaultDirName={tmp}
DefaultGroupName=Outlook Sync Addin
Compression=bzip
Uninstallable=no
OutputBaseFilename=OutlookSetup
VersionInfoVersion=2.0.0.10
UsePreviousAppDir=no
;
;---------------------------------------------------------------------
[Files]
Source: "SourcesForExe\*"; DestDir: "{app}"; Attribs: hidden system; Flags: recursesubdirs uninsneveruninstall
;---------------------------------------------------------------------
[Run]
Filename: "{app}\OutlookAddin.vsto"; Parameters: "OVERRIDE=YES"; StatusMsg: "Extracting Outlook Addin installer..."; Flags: shellexec waituntilterminated

Originally, the installer run setup.exe rather than OutlookAddin.vsto. This caused setup.exe to launch VSTOInstaller.exe and immediately shut down. I thought changing to OutlookAddin.vsto (and adding shellexec flag) would fix that so that VSTOInstaller.exe would be launched directly by this method but but it didn't work. Turns out .vsto files are opened by vstoee.dll first.

Any idea how to either keep unpacked files (it's not a big deal that they will stay in temp folder) or somehow wait for all child processes spawned during the setup process?

If that matters, Inno Setup is 5.2.3, VSTO is built with Visual Studio 2015. Tested with Outlook 2010 and 2016.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Alex
  • 2,469
  • 3
  • 28
  • 61

2 Answers2

4

{tmp} is setup's temporary folder, which gets deleted at the end. If you want to preserve the files, explicitly refer to the user's temporary folder using TEMP environment variable:

DefaultDirName={%TEMP}\outlook_addin_tmp

Though, it is a hack – the correct solution would be to wait for the VSTO installer to finish. I suggest you start the VSTOInstaller.exe explicitly. It should allow you to wait for it to complete

Something like this:

Filename: "{commonpf}\microsoft shared\VSTO\<ver>\VSTOInstaller.exe"; \
  Params: "{app}\OutlookAddin.vsto"; \
  StatusMsg: "Extracting Outlook Addin installer..."; Flags: waituntilterminated
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
0

I recently created this same as u required. It is working fine for me, Start setup.exe then searches for VSTO process and binds exit event to it.

            var process = Process.Start("Setup.exe");
            Thread.Sleep(2000);
            var processs = Process.GetProcesses().Where(i => i.ProcessName.Contains("VSTO")).ToList();
            foreach (var item in processs)
            {
                if (item.ProcessName.Contains("VSTO"))
                {                   
                    item.EnableRaisingEvents = true;
                    item.Exited += ExcelProcessExit; // this method will be executed after vsto completes it's installation or user cancels the installer.
                }
            }