Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
751 views
in Technique[技术] by (71.8m points)

.net - How to create a installer, that installs a 3rd-Party Setup (exe) and locates custom files to the same directory?

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

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

  • 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"

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.

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

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)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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>


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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...