开发者

how to include "MSVC Runtime.exe" in my MSI installer proj, and have it be run if it's not installed?

开发者 https://www.devze.com 2023-03-16 05:40 出处:网络
i want to have the \"vcredist_x86.exe\" included in my installer package. requirements: 1) built in to the msi file, not a separate package, not a separate install

i want to have the "vcredist_x86.exe" included in my installer package.

requirements: 1) built in to the msi file, not a separate package, not a separate install 2) runs automatically as part of single installer 3) only runs if not already installed 4) does not leave extra copy of itself on users hard drive 5) succeeds to build installer file from command line scripts 6) installer must succeed when run

what i tried: 1) project->properties->config props->build->Prerequisites, then check "Create setup program to install prereq components", then check "Visual C++ Runtime Libraries"

problems: violates all requirements except 6, which is moot.

2) in installer pro, show "File System", then add "vcredist_x86.exe" to the user's desktop or application folder, then under "Custom Actions", under "Install", right click->Add Custom Action, then pick "vcredist_x86.exe" from the install location. then select it, then in "Properties" under "Arguments", change "/Install" to "/Install /qb!" (this should cause the install to be "Unattended install with no cancel button"

problems: violates requirements 3, 4 and 6. As to 6: when running the installer, it fails with the message "There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor." That would be me, and i do not know what 开发者_开发百科to do.


Let's start with some prerequisite rules and best practices:

  • they use separate packages
  • installed only when required
  • handled by an EXE bootstrapper
  • most of them cannot run as part of the main MSI installation process

Most of these break your requirements. Another approach is using the Visual Studio merge modules from "C:\Program Files\Common Files\Merge Modules":

http://msdn.microsoft.com/en-us/library/ms235290.aspx

http://msdn.microsoft.com/en-us/library/8x727h8b.aspx

Visual Studio setup projects cannot install merge modules conditionally, so they will always be installed. Other setup authoring tools allow you to condition merge modules based on their associated feature:

  • create a search which determines if the merge module is installed or not
  • condition the merge module feature with that search result

A third option would be to include just your application dependencies: http://msdn.microsoft.com/en-us/library/ms235317(VS.90).aspx

In this case only your application will have access to the runtime. This approach supports conditional install:

  • create a search which determines if the runtime is installed
  • use that search to condition each dependency file


Okay, the solution was to use IExpress and have the thing it executes be a shell script (.bat file).

in the .bat file, have it create the "vcredist_x86" folder and move the "vcredist_x86.exe" into it, then just run setup.exe

this meets all my original requirements.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号