在Qt安装程序框架(QtIFW)安装程序中安装VC ++可再发行组件吗? [英] Installing VC++ Redistributables in a Qt Installer Framework (QtIFW) installer?

查看:295
本文介绍了在Qt安装程序框架(QtIFW)安装程序中安装VC ++可再发行组件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Qt Installer Framework(v2.0.1)为我的应用程序构建安装程序.我正在为Windows上的x86和x64构建我的应用程序,因此我为每种体系结构构建一个安装程序,并在每个体系结构中打包了不同的VC ++可再发行组件(MSVC ++ 2013中的vcredist_x86.exe和vcredist_x64.exe). QtIFW文档的细节很令人沮丧,但我发现我可以在installscript.qs中添加一个操作,以在提取文件后以静默方式运行vcredist安装程序:

I am building installers for my app with the Qt Installer Framework (v2.0.1). I'm building my app for both x86 and x64 on Windows, so I'm building an installer for each architecture, with different VC++ Redistributables packaged in each (vcredist_x86.exe and vcredist_x64.exe from MSVC++2013). The QtIFW documentation is frustratingly short on details, but I found that I can add an operation in installscript.qs to run the vcredist installer silently after my files are extracted:

component.addOperation("Execute", "@TargetDir@/vcredist_x64.exe", "/quiet", "/norestart");

但是然后我遇到了确定我的安装程序是x86还是x64版本的问题.有没有办法从安装脚本中确定这一点?也许有一种浏览要提取的文件列表的方法?还是有一种更简单的方法来完成看似常见的安装VCRedists的任务?

But then I have the problem of determining whether my installer is the x86 or x64 version. Is there a way to determine this from the installscript? Perhaps a way to look through the list of files to be extracted? Or is there an easier way to accomplish this seemingly common task of installing the VCRedists?

文档仅说明了这一点:

要在最终用户的系统上安装运行时库,您需要在应用程序中包含适当的Visual C ++可再发行组件包(VCRedist)可执行文件,并确保在用户安装应用程序时执行该可执行文件.

To install the runtime libraries on the end-user's system, you need to include the appropriate Visual C++ Redistributable Package (VCRedist) executable with your application and ensure that it is executed when the user installs your application.

但是它没有提供有关如何确保已执行"的任何详细信息.

But it doesn't offer any details on how to "ensure that it is executed".

推荐答案

我遇到了类似的问题.您可以使用 systeminfo.currentCpuArchitecture 来获取系统体系结构.为了找出给定的体系结构是否为x64,我所做的是:

I had a similar problem. You can get the systems architecture using the systeminfo.currentCpuArchitecture . To find out, whether the given architecture is x64, what I did was:

if(systemInfo.currentCpuArchitecture.search("64") < 0) {
    //x86
} else {
    //x64
}

注意:这将返回OS架构,因此x64 CPU上的x86 OS将被视为x86.

Note: This will return the OS architecture, so a x86 OS on a x64 CPU will be seen as x86.

看看: https://github.com/Skycoder42/QtIFW-Advanced -设置.这是我创建的一个示例项目,它做了很多其他工作来改善QtIFW的工作,例如修复安装路径或正确处理脱机/在线安装程序.

Have a look at: https://github.com/Skycoder42/QtIFW-Advanced-Setup . It's a sample project I created that does a lot of additional stuff to improve working with QtIFW, like for example reparing the install path or properly handling offline/online installers.

这篇关于在Qt安装程序框架(QtIFW)安装程序中安装VC ++可再发行组件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆