Installation 如何使Inno安装程序在安装完成后或VSTO安装程序完成后保留临时文件?

Installation 如何使Inno安装程序在安装完成后或VSTO安装程序完成后保留临时文件?,installation,vsto,inno-setup,clickonce,Installation,Vsto,Inno Setup,Clickonce,我有Inno安装程序(在我之前写的),它提取一组VSTO文件,然后启动VSTO MS Office插件安装。它有一个问题,将VSTO文件提取到临时文件夹并启动VSTOInstaller.exe后,它会立即显示Finish按钮。如果用户单击它,将删除临时文件,并在VSTOInstaller中启动VSTO加载项的实际安装,然后导致“找不到文件”错误。我应该解决这个问题(理想情况下,只有当它生成的VSTOInstaller完成执行时,Inno安装程序中的Finish按钮才会出现) VSTO包本身(一组

我有Inno安装程序(在我之前写的),它提取一组VSTO文件,然后启动VSTO MS Office插件安装。它有一个问题,将VSTO文件提取到临时文件夹并启动
VSTOInstaller.exe
后,它会立即显示Finish按钮。如果用户单击它,将删除临时文件,并在
VSTOInstaller
中启动VSTO加载项的实际安装,然后导致“找不到文件”错误。我应该解决这个问题(理想情况下,只有当它生成的
VSTOInstaller
完成执行时,Inno安装程序中的Finish按钮才会出现)

VSTO包本身(一组“应用程序文件”文件夹、
setup.exe
.VSTO
文件)是通过Visual Studio中的ClickOnce发布工具创建的。包裹上有数字签名等

我尝试了各种选择:

  • 在打开
    .vsto
    文件的过程完成之前(使用
    waitUnterminated
    标志),不完成Inno安装程序安装。不起作用,似乎在打开
    .vsto
    文件的过程中更改,
    VSTOInstaller
    不是链中的第一个过程。因此,Inno安装程序只等待进程快速将执行传递给另一个进程(
    VSTOInstaller
    ),然后关闭
  • 在安装时不删除提取的文件(使用
    uninserveruninstall
    标志)。看起来它只适用于卸载,而在安装过程中删除临时文件则有所不同。在完成安装后,我没有找到任何方法保持未打包的文件完好无损
当前
.iss
文件看起来像:

;---------------------------------------------------------------------
[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
最初,安装程序运行的是
setup.exe
,而不是
OutlookAddin.vsto
。这导致
setup.exe
启动
VSTOInstaller.exe
并立即关闭。我认为更改为
OutlookAddin.vsto
(并添加
shellexec
标志)可以解决这个问题,这样就可以通过此方法直接启动
VSTOInstaller.exe
,但它不起作用。原来
.vsto
文件首先由
vstoee.dll
打开

您知道如何保存未打包的文件(它们将保留在临时文件夹中并不是什么大问题),或者如何等待安装过程中生成的所有子进程吗

如果这很重要的话,Inno设置是5.2.3,VSTO是用Visual Studio 2015构建的。使用Outlook 2010和2016进行测试。

是安装程序的临时文件夹,最后会被删除。如果要保留文件,请使用
TEMP
环境变量显式引用用户的临时文件夹:

DefaultDirName={%TEMP}\outlook_addin_tmp

不过,这是一种黑客行为——正确的解决方案是等待VSTO安装程序完成。我建议您显式启动
VSTOInstaller.exe
。它应该允许您等待它完成

大概是这样的:

Filename: "{commonpf}\microsoft shared\VSTO\<ver>\VSTOInstaller.exe"; \
  Params: "{app}\OutlookAddin.vsto"; \
  StatusMsg: "Extracting Outlook Addin installer..."; Flags: waituntilterminated
文件名:“{commonpf}\microsoft shared\VSTO\\VSTOInstaller.exe”\
参数:“{app}\OutlookAddin.vsto”\
StatusMsg:“正在提取Outlook加载项安装程序…”;旗帜:WaitUnterminated
是安装程序的临时文件夹,最后会被删除。如果要保留文件,请使用
TEMP
环境变量显式引用用户的临时文件夹:

DefaultDirName={%TEMP}\outlook_addin_tmp

不过,这是一种黑客行为——正确的解决方案是等待VSTO安装程序完成。我建议您显式启动
VSTOInstaller.exe
。它应该允许您等待它完成

大概是这样的:

Filename: "{commonpf}\microsoft shared\VSTO\<ver>\VSTOInstaller.exe"; \
  Params: "{app}\OutlookAddin.vsto"; \
  StatusMsg: "Extracting Outlook Addin installer..."; Flags: waituntilterminated
文件名:“{commonpf}\microsoft shared\VSTO\\VSTOInstaller.exe”\
参数:“{app}\OutlookAddin.vsto”\
StatusMsg:“正在提取Outlook加载项安装程序…”;旗帜:WaitUnterminated

我最近根据需要创建了这个。 它对我来说工作正常,启动setup.exe,然后搜索VSTO进程并将退出事件绑定到它

            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.
                }
            }

我最近创建了与您所需的相同的。 它对我来说工作正常,启动setup.exe,然后搜索VSTO进程并将退出事件绑定到它

            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.
                }
            }

您是否尝试显式运行
VSTOInstaller.exe
?还有什么可以处理
.vsto
扩展?因此,您是否可以尝试显式运行
VSTOInstaller.exe
?是的,它可能会工作。但是我不能在生产中使用它,因为我不知道最终用户系统上VSTOInstaller.exe的路径。如果将
{tmp}
中的
DefaultDirName
替换为
{%TEMP}\outlook\u addin\u tmp
应保留文件。您是否尝试显式运行
VSTOInstaller.exe
?还有什么可以处理
.vsto
扩展名?因此,您是否可以尝试显式运行
VSTOInstaller.exe
?是的,它可能会工作。但是我不能在生产中使用它,因为我不知道最终用户系统上VSTOInstaller.exe的路径。如果将
DefaultDirName
中的
{tmp}
替换为
{%TEMP}\outlook\u addin\u tmp
,则应保留文件。