installing 3rd party applications in C# installer

爷,独闯天下 提交于 2019-12-12 03:49:46

问题


I've created an installer in VS2010 for installing my application, but it has some 3rd party prerequisites such as python. I've tried to include the additional installers as embedded resource, extract them as files and run them (as custom actions). It works, but seems like running 2 installers at the same time is impossible, so when these installers are installed from my installer, I get an error.

How can I install these 3rd party applications during my application installation? (The 'prerequisites' in the property pages are not helping, as they are only relevant for ms stuff such as .NET and sql server...)

Thanks!


回答1:


you can use System.Diagnostics.Process for that. It can execute files on a given path, e.g. MySQL server installer. see this You would however need to supply the executable file.As Ramhound suggested in his comment, have a look at the commercial products to author your installer. Several, including my personal favorite Advanced Installer, offer free versions of the tool that may satisfy your initial requirements.

Depending upon how the prerequisites are packaged (MSI or EXE) your MSI might not directly be able to install the prereq without the use of a custom action or a bootstrapper that would search the target system for the prereq and install it if it not present on the target system.

As an aside, I have no affiliation with Advanced Installer other than the fact that I've been a paying customer for a few years now. In addition to a solid product their service is excellent as well.




回答2:


I just encountered this same issue. I was using Bootstrapper Manifest Generator to create my bootstrap packages and then in my setup project I selected these as prerequisites. One of the prerequisites was Python as well. According to the install log, the Python install would exit with code 0 and with status 'InstallFailed'.

I found that the install actually succeeded, but 0 wasn't being recognized as a successful exit code. I fixed this in BMG, in the Install File properties. There's an Exit Codes tab where you can manually enter exit codes and results. I added 0 with a result of Success, rebuilt the package, copied it to the bootstrapper package folder, and finally rebuilt my setup project. After that the install worked fine. Here's a screenshot of my BMG settings:

If you're not using BMG, you could manually edit Commands node of the Product.xml similar to this:

<Commands Reboot="Defer">
   <Command PackageFile="python-2.7.5.msi" Arguments="/q /norestart">
      <ExitCodes>
         <ExitCode Value="0" Result="Success" />
            <DefaultExitCode Result="Fail" String="Anunexpectedexitcodewasr" FormatMessageFromSystem="true" />
      </ExitCodes>
   </Command>
</Commands>


来源:https://stackoverflow.com/questions/14796583/installing-3rd-party-applications-in-c-sharp-installer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!