代码之家  ›  专栏  ›  技术社区  ›  deerchao

安装后启动,没有UI?

  •  16
  • deerchao  · 技术社区  · 15 年前

    在安装后没有UI(或在安静模式下)如何启动应用程序?谢谢


    4 回复  |  直到 15 年前
        1
  •  15
  •   Wim Coenen    15 年前

    从上的msdn主题 sequencing custom actions :

    在中计划的自定义操作 安装顺序或 仅当 全水平。

    InstallExecuteSequence 这样地:

      <InstallExecuteSequence>
         <Custom Action='LaunchApplication' After='InstallFiles'/>
      </InstallExecuteSequence>
    

    Id 你的 CustomAction 元素。

    例如我看了看报纸 instructions 我看不到启动应用程序的自定义操作是按任何顺序安排的。它仅从UI操作(单击“完成”按钮)触发。这就解释了为什么在静默安装期间从不执行它。

    编辑

    <?xml version='1.0' encoding='utf-8'?>
    <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
       <Product
             Name='ProductName'
             Id='*'
             Language='1033'
             Version='0.0.1'
             Manufacturer='ManufacturerName' >
          <Package
                Keywords='Installer'
                Description='Launch application demo'
                Manufacturer='ManufactererName'
                InstallerVersion='100'
                Languages='1033'
                Compressed='yes'
                SummaryCodepage='1252'/>
    
          <Media Id='1' Cabinet='test.cab' EmbedCab='yes'/> 
    
          <Directory Id='TARGETDIR' Name="SourceDir">
             <Directory Id='ProgramFilesFolder'>
                <Directory Id='TestFolder' Name='Test' >
                   <Component Id="ExeComponent" Guid="*">
                      <File Id="ExeFile" Source="c:\windows\notepad.exe" />
                   </Component>
                </Directory>
             </Directory>
          </Directory>
    
          <Feature Id='Complete'
                Display='expand'
                Level='1'
                Title='Test'
                Description='Test'>
             <ComponentRef Id="ExeComponent" />
          </Feature>
    
          <InstallExecuteSequence>
             <Custom Action='LaunchInstalledExe' After='InstallFinalize'/>
          </InstallExecuteSequence>
    
          <CustomAction Id="LaunchInstalledExe"
             FileKey="ExeFile"
             ExeCommand="" 
             Execute="immediate" 
             Impersonate="yes" 
             Return="asyncNoWait" />
    
       </Product>
    </Wix>
    
        2
  •  4
  •   deerchao    13 年前

    在我的最终解决方案中,我使用了两个属性,一个用于UI( 在退出时启动应用程序 自动更新\u ).

    我必须这样做,因为如果我在 在全UI模式下,应用程序将启动 之前

    现在我可以打电话了 setup.exe/qn自动更新\u=1 在我的程序中进行更新。

    <Property Id="LAUNCH_APP_ON_EXIT" Value="1" />
    <Property Id="UPDATING_AUTOMATICALLY" Value ="0" />
    
    <CustomAction Id="LaunchApplication" FileKey="mainExecutableFile" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
    
    <UI>
        <!-- explainations: http://www.dizzymonkeydesign.com/blog/misc/adding-and-customizing-dlgs-in-wix-3/ -->
      <UIRef Id="MyWixUI_InstallDir" />
      <UIRef Id="WixUI_ErrorProgressText"/>
    
      <Publish Dialog="MyExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">LAUNCH_APP_ON_EXIT</Publish>
    </UI>
    
    <InstallExecuteSequence>
      <Custom Action='LaunchApplication' After='InstallFinalize'>UPDATING_AUTOMATICALLY = 1</Custom>
    </InstallExecuteSequence>
    
        3
  •  1
  •   Franci Penov    15 年前

    我假设您是从自定义操作启动应用程序,该操作是通过绑定到复选框的属性触发的。如果是这种情况,可以尝试将该属性指定为setup.exe的命令行参数。例如,如果您的自定义操作绑定到MSI属性LAUNCH_NEW_VERSION,则可以如下方式调用setup.exe:

    setup.exe /q LAUNCH_NEW_VERSION=1
    

    标准安装引导程序应将该属性/值传递给MSI引擎。如果没有,可以考虑直接调用.MSI,而不是调用BooTrasePer-exe来运行安装程序。

        4
  •  1
  •   Scott Boettger    15 年前

    这就是我采取的方法。

    <Property Id="WixShellExecTarget" Value="[#(the id of your exe here)]" />
    <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
    

    推荐文章