如何创建安装程序,安装第 3 方安装程序 (exe) 并将自定义文件定位到同一目录? [英] How to create a installer, that installs a 3rd-Party Setup (exe) and locates custom files to the same directory?

查看:29
本文介绍了如何创建安装程序,安装第 3 方安装程序 (exe) 并将自定义文件定位到同一目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望这个标题是有意义的,不会误导我的要求.

I hope this title is meaningful, and is not misleading my request.

我想将 My Application 部署为安装文件,这需要 3rd-Party 依赖项.
目标:Windows 7/8

I want to deploy My Application as a setup file, that requires 3rd-Party dependencies.
Target: Windows 7/8

  • 我的应用程序(C#.NET 项目)
  • 第三方工具(.exe 安装程序)
    • [-] 额外向系统添加 RegKeys,具体取决于稍后在 我的应用程序 所需的设置向导中选择的选项.
    • [+] 支持静默安装(带参数)
    • setup.exe/S/D="C:Program Files (x86)3rd-Party"
    • My Application (C#.NET project)
    • 3rd-Party Tool (.exe setup)
      • [-] Additionally adds RegKeys to the system, depending on the chosen options in the setup wizard that are required for My Application later on.
      • [+] Supports silent install (with arguments)
      • setup.exe /S /D="C:Program Files (x86)3rd-Party"

      我的应用程序应与第 3 方存储在同一目录中.
      因此,顺序是静默安装 setup.exe,并在完成后安装;我的应用程序应该位于同一个地方.
      可选地,安装程序可以检查是否已经安装了 3rd-Party,但这不是必需的,因为静默安装 /S 不会进行任何更改或导致任何问题原件.

      My Application should be stored in the same directory as the 3rd-Party.
      So the order would be to silently install the setup.exe, and after it's finished; My Application should be located the same place.
      Optionally the setup could check if the 3rd-Party is installed already, but that is not necessary, since the silence installation /S would not make any changes or cause any problems to the original.

      设置向导应遵循以下页面:

      The setup wizard should follow up with the following pages:

      Setup StartPage -> Licens agreement -> Choose installion path -> Progress -> Finish.
      

      选择安装应该指向一个变量,该变量将用于3rd-Party应用程序我的应用程序的静默安装.

      The Choose installation should point to a variable, which will be used for the silent installation of the 3rd-Party application and My Application.

      您建议在这种情况下使用什么?(请仅提供免费解决方案)
      我会简要介绍一下 Inno-Setup 和 WiX,但对于这个小东西来说,它们似乎有点矫枉过正.
      此外,我想指出我没有设置脚本语言的经验.(时间常数)

      What do you recommend to use in this case? (only free solutions please)
      I'd a brief look into Inno-Setup and WiX, but they seemed a bit overkill for this little thing.
      Furthermore I want to point that I do not have experience with the script-languages of setups. (time constant)

      推荐答案

      你还需要这个吗?使用 WiX,这将相当简单:您需要创建两个项目:一个打包您的额外文件的 MSI,然后将该 MSI 和现有的 setup.exe 放入 WiX 包中.

      可以将参数传递给 setup.exe 以使其静默安装,但您必须首先生成响应文件.(使用/s/r 运行安装程序,然后找到 setup.iss 文件,通常在 C:Windows 中.)然后您必须通过 <InstallCommand>并且转义引号可能很棘手.不要将 setup.exe 本身作为参数传递.要查看最终通过的内容,请查看安装日志.

      Do you still need this? With WiX that this would be fairly straightforward: you need make two projects: an MSI which packages your extra files, and then put that MSI and the existing setup.exe into a WiX bundle.

      Passing the arguments to the setup.exe so it installs silently can be done, but you have to generate a response file first. (run the setup with /s /r, and then find the setup.iss file, usually in C:Windows.) And then you have to pass those via <InstallCommand> and escaping the quotes can be tricky. Don't pass setup.exe itself as an argument. To see what eventually gets passed, look at the install log.

      以下是捆绑包所需内容的概要,大部分是完整的代码:(您必须想出 id,并设置路径到机器上的位置).

      Below is an outline of what you need for the bundle, mostly complete code: (you'll have to come up with id's, and set the paths to where things are on your machine obviously).

      <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
            xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
      
          <Bundle Name="some-cool-name-for-the-whole-thing"
              Version="1.0"
              UpgradeCode="your-guid-here">
      
          <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
              <bal:WixStandardBootstrapperApplication
                  LicenseUrl=""
                  ShowVersion="yes"/>
          </BootstrapperApplicationRef>
      
          <Chain>
      
          <ExePackage Id="some_id"
              SourceFile="path-to-the-setup.exe">
          <CommandLine InstallArgument="/s /f1&quot;fullpath-to-your-iss-file.iss&quot;/>
          </ExePackage>
      
          <MsiPackage Id="some-other-id-here"
              SourceFile="path-to-the-MSI-you-made-for-your-app">
          </MsiPackage>
      
      
          </Chain>
          </Bundle>
          </Wix>
      


      对于 MSI,再次大致完整地列出您需要的内容:


      For the MSI, again a mostly complete outline of what you need:

      <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
      
          <Product Id="*"
          Name="name-of-your-app"
          UpgradeCode="some-unique-constant-guid-across-versions">
      
          <Package InstallerVersion="500" 
              Compressed="yes"<br>
              InstallScope="PerMachine"/>
      
      
          <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
      
          <MediaTemplate EmbedCab="yes" />
      
      
          <Directory Id="TARGETDIR" Name="SourceDir">
              <Directory Id="ProgramFilesFolder">
                 <Directory Id="my_app_install_dir" Name="My App" />
              </Directory>
          </Directory>
      
          <ComponentGroup Id="the-component-group-id" Directory="my_app_install_dir">
      
              <Component Id="some-other-id-name" Guid="{some-new-GUID}" >
                  <File Id="some-id-1-for-your-file" Source="path-to-your-file" KeyPath="yes" />
               </Component>
      
               <Component Id="some-other-id2-name" Guid="{some-new-GUID2}">
                   <File Id="some-id-2-for-your-another-file" Source="path-to-another-file" KeyPath="yes" />
               </Component>
      
          <!-- add more files as needed -->
      
          </ComponentGroup>
      
      <Feature Id="some-feature-id" Title="some-title" Level="1">
          <ComponentGroupRef Id="the-component-group-id" />
          </Feature>
          </Product>
          </Wix>
      

      这篇关于如何创建安装程序,安装第 3 方安装程序 (exe) 并将自定义文件定位到同一目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆