Including the Microsoft Visual C++ runtime in your installer



1 comment

  • Avatar

    Note:In this example we use the Microsoft Visual C++ 2008 Redistributable Package (x86). Including a different version will be a similar process but you will need to check specific differences in the installation of the package.

    Microsoft Visual C++ 2008 Redistributable Package (x86) is just an executable that can be bundled with the installer, deployed during the installation and run it in silent mode.

                            <progressText>Installing VC++ 8 runtime</progressText>
                            <programArguments>/q:a /c:"msiexec /i vcredist.msi /qn /l*v ${system_temp_directory.dos}\vcredist_x86.log"</programArguments>

    For installing the runtime package Windows Installer 3.1 or later is recommended. You can check that the user has the right version of msiexec and if not show a message to the user. You can include this checking in the <initializationActionList>

        <setInstallerVariable name="msiexec" value="" />
        <setInstallerVariable name="msiexec" persist="1" value="msiexec.exe">
                <programTest name="msiexec.exe" condition="is_in_path" />
        <setInstallerVariable name="msiexec" persist="1" value="${windows_dir}/system32/msiexec.exe">
                <fileTest condition="exists" path="${windows_dir}/system32/msiexec.exe" />
                <compareText text="${msiexec}" value="" nocase="0" logic="equals" />
                  <getWindowsFileVersionInfo type="version" path="${msiexec}" variable="msi_version" />
                <setInstallerVariableFromRegEx name="msi_version" text="${msi_version}" pattern="(^[0-9]+)\.([0-9]+)\..*" substitution="\1.\2" />
                  <compareText text="${msiexec}" value="" nocase="0" logic="does_not_equal" />
            <text>You need at least Windows Installer MSI version 3.1.</text>
                <compareText text="${msiexec}" value="" nocase="0" logic="equals" />
                <compareValues value1="${msi_version}" value2="3.1" logic="less" />

    Here you can find a demo xml project that will create an installer for the Microsoft Visual C++ 2008 Redistributable Package (x86). For building the demo installer you will need to place the vcredist_x86.exe executable and the attached xml file in the same folder.

    Notice that this is only a demo project and you may need to add some uninstallation steps, some validations (for instance, check whether the user already has this runtime version installed) and integrate it with the installation of your own software.

    Comment actions Permalink

Please sign in to leave a comment.