如何通过Visual Studio安装程序安装可再发行组件?

问题描述:

我希望使安装程序(Visual Studio安装程序)能够安装可再发行组件(Visual C ++ 2013可再发行组件x86),以防未在PC上安装它或为我的程序安装必需的dll.我希望设置启动条件.​​

I wish to make my installer (visual studio setup) to install redistributable (Visual C++ 2013 redistributable x86) in case it isn't installed on the PC or install the necessary dll for my program. I don't wish to set a launch condition.

如果可能的话,我希望可重新分发的安装保持安静.

If possible, I wish that the installation of the redistributable to be silent.

有什么建议吗?

这是安装项目的属性"中的先决条件"按钮的作用.在看到该按钮之前,您需要设置一个配置(例如Release).那就是您添加VC ++运行时的地方.这将生成一个由用户运行的setup.exe-它会安装所有这些必备组件,然后安装您的MSI文件.

That's what the Prerequisites button is for in the setup project's Properties. You'll need to set a configuration (such as Release) before you see that button. That's where you add the VC++ runtimes. That will generate a setup.exe that users run - it will install any of those prerequisites and then install your MSI file.

要使其静默,您需要进入描述用于安装运行时的命令的清单文件,并将其更改为静默命令.如果您仍然可以找到的话,曾经有一个名为Bootstrap Manifest Generator的工具可以执行这种操作.

To make it silent you'd need to get into the manifest file that describes the command used to install the runtime, and change it to a silent command. There used to be a tool called the Bootstrap Manifest Generator that would do that kind of thing, if you can still find it.

我不知道对以下任何一种支持,但这是VS引导程序的工作方式,因此请自行承担风险:)

There's no support I know of for any of the following, but this is how the VS bootstrapper works, so mangle at your own risk :)

您可以使用Visual Studio将生成的setup.exe作为文件打开并检查资源-在41下有一个setupcfg,它是先决条件的具体说明.您需要将其导出,更改并重新导入.

You could open the built setup.exe as a file with Visual Studio and examine the resources - under 41 there's a setupcfg that's the specicification for the prereqs. You'd need to export it, alter it and re-import it.

或者,此使用的标准先决条件的模板来自SDK,其依赖于体系结构的位置,例如程序文件(x86)\ Microsoft SDKs \ Windows \ v8.1A \ Bootstrapper \ Packages \ vcredist_x86 \ product.xml,因此如果进入该Xml文件并找到正确的VCRedistInstalled设置和命令行,请将其设置为静默,并且在进行构建时应传播到setup.exe中.这是不安全的,因为a)您已经更改了文件,因此现在不会通过任何SDK更新进行更新b)文件与SDK安装的文件不匹配,并且可能存在安装程序修复问题,并且c)每个引导程序版本将受到影响.

Alternatively, the template for the standard prereqs that this uses comes from the SDK in architecture-dependent locations such as Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper\Packages\vcredist_x86\product.xml so if you go in that Xml file and find the correct VCRedistInstalled settings and command lines, make it silent, and it should propagate into the setup.exe when you do the build. This is unsafe because a) you've altered a file so that will now not be updated by any SDK updates b) The file doesn't match the one installed by the SDK and there may be installer repair issues and c) Every bootstrapper build will be affected.