Visual Studio 2017 Installer Project - include VC++ 2015 Redistributable

亡梦爱人 提交于 2019-12-17 07:54:19

问题


I am creating the installer for my application using a "Visual Studio Installer" project type in Visual Studio 2017.

I want my installer to install visual c++ redistributable 2015 with my application. I've downloaded the vc_redist.x86.exe file, included it in my project, and I'm trying to do the install as a custom action on "install". I am launching with the arguments /install /passive /norestart.

When I execute my installer, when it does the custom action, I get this error:

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.

I can run vc_redist.x86.exe /install /passive /norestart at the command prompt with no problem or errors.

Any suggestions or alternative ways to include Visual C++ redistributable as part of my install?


回答1:


Recommendation: Migrate to WiX Burn (bootstrapper / downloader / sequencer) to allow more future flexibility and control (WiX links below).

Alternatively try the prerequisites section below first (select the "Visual Studio 14" entries for install) or try the merge modules available (section below). Please pay attention to the disclaimers for the merge modules.

  • WiX Burn XML Markup Sample.
  • WiX Burn Information & Simple Markup Sample - with lots of links for further information.
  • WiX - Install Prerequisites and 3rd party applications

Logging & Mutex: What does the log file say? From a technical point of view the usual problem is that you can not install another MSI package from within your own running MSI setup due to technical runtime restrictions. A mutex is set to prevent several MSI installation transactions to happen at once. Check the logs. This redistributable is MSI-based I believe - so you will see this problem when running the EXE from a custom action like you do.

Deployment Tools: Visual Studio Installer Projects are very limited, and it seems most people migrate away from them to another deployment tool over time. Maybe have a look here - and here is a list of tools. WiX's Burn feature (bootstrapper / downloader / sequencer) can achieve what you need. Also read PhilDW's answer here.

Prerequisites: Visual Studio Installer Projects do have a prerequisites view (click the Prerequisites... button) where a limited number of prerequisites can be defined for installation via the setup.exe bootstrapper (not kicked off from within your MSI itself, but from its bootstrapper setup.exe - this means you don't kick off the install from within your own MSI, but before it starts to install - and it can hence work correctly). I am not sure if the entries for "Visual Studio 14" are for the runtime version you need. You could give it a try I suppose.

Merge Modules: There are merge modules to install the Visual Studio Runtime (see here, section "Visual C++ Runtime" - quite a bit down the page), but they seem inadequate these days for reasons explained here (very important). Essentially the Visual Studio Runtime is more complicated from 2015 onwards - and the EXE installer is preferred. Must read link - please. In order to locate relevant merge modules, please search for *.msm files underneath %ProgramFiles(x86)% - if you have Visual Studio (and / or the Windows SDK) installed. Merge modules can be installed embedded in your own package without the need for a setup.exe launcher. In Visual Studio, right click your installer project, Add, then Merge Module...




回答2:


You can't run that redistributable as a custom action because it's an MSI-based install, and you cannot run recursive MSI installs (yours calling the VC redist one).

In Visual Studio setup projects you're supposed to use the Prerequisites feature. Right-click the setup project in Solution Explorer, choose Properties, then Prerequisites. This will build a setup.exe to install prerequisites followed by your MSI file. As far as I can tell, the Microsoft Visual C++ 14 is the Visual Studio 2015 runtimes.



来源:https://stackoverflow.com/questions/52119157/visual-studio-2017-installer-project-include-vc-2015-redistributable

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