简体   繁体   中英

Are there smaller Visual Studio 2015 C++ Redistributable (vcredist_x86.exe) than 14 MB?

I have a Windows x86 32 bit desktop application built using Visual Studio 2015 written in C and C++ using the MFC framework for the User Interface. For the installer I am using NSIS compiler with an NSIS script to generate the installation.exe used to install the application which is composed of some 10 different components, .exes and.dlls that are created by the build.

My desktop application is a point of sale application that runs under 32 bit or 64 bit versions of POSReady 7 (Windows 7) as well as Windows 10 and Windows 10 IoT Enterprise (not Windows IoT Core) on Intel x86/x64 compatible CPUs.

When I changed from Visual Studio 2005 to Visual Studio 2015, I was struck by the larger size of the installation executable, from a size of roughly 8 MB to a size of 16 MB. The size difference seems to be due to the Visual Studio 2015 C++ Redistributable that I am including in the desktop application installer.

The NSIS script has the following lines:

# The location of the Visual Studio 2005 C++ Runtime Redistributable depends on the version of
# Windows being used to build the application. Beginning with Windows 7 there are now two different
# folder hierarchies for installed programs.
File "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\1033\vcredist_x86.exe"

ExecWait '"$INSTDIR\vcredist_x86.exe" /q:a /c:"msiexec /i vcredist.msi /qb!"'   #dialog with no cancel

When I compile the desktop application with Visual Studio 2015 and run the NSIS script with the File directive containing the vcredist_x86.exe commented out, the size of the resulting installer is 2,220 KB. When I uncomment the File directive containing the vcredist_x86.exe , the size of the resulting installer is 16,140 KB.

Looking in the folder C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\1033 I see three different redistributables: vcredist_arm.exe size 2,639 KB, vcredist_x64.exe size 14,957 KB, and vcredist_x86.exe size 14,130 KB.

Is there a different Visual Studio 2015 redistributable that is smaller than 14 MB?

Or is there a different method I can use to provide vcredist_x86.exe where I do not need to include it within my application installer? A different method would need to be as automatic as the current solution which installs the application components then starts up the Visual Studio 2015 redistributable installer.

Notes

  1. This post has an answer of including specific Visual Studio DLLs into the components list for the installer. How to avoid Visual C++ Redistributable LARGE file installing?

    That would not seem to be a viable alternative due to copyright issues.

  2. Here are links to Microsoft documentation Redistributing Visual C++ Files as well as Determining Which DLLS to Redistribute which includes an alternative of using merge modules as discussed in Redistributing Components By Using Merge Modules . However the page on merge modules says:

    We recommend that you not use merge modules except when you don't have to service your application and you don't have dependencies on more than one version of the DLLs. Merge modules for different versions of the same DLL cannot be included in one installer, and merge modules make it difficult to service DLLs independently of your application. Instead, we recommend that you install a Visual C++ Redistributable Package.

If I remember correctly, you may provide the required DLLs with your application rather than the installer. Another option is to go for static linking.

These approaches will result in a much smaller overall size, but the dependencies will never be updated for fixes unless you do so. This may be a deal breaker or not depending on the situation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM