Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Mailbag: How to perform a silent install of the Visual C++ 2010 redistributable packages

Mailbag: How to perform a silent install of the Visual C++ 2010 redistributable packages

  • Comments 45

Question:

You previously posted lists of command line switches to perform silent and unattended installations of the Visual C++ 2005 redistributable and the Visual C++ 2008 redistributable.  How can I perform silent and unattended installations of the Visual C++ 2010 redistributable?

Answer:

The Visual C++ 2010 redistributable packages (vcredist_x86.exe, vcredist_x64.exe and vcredist_ia64.exe) support the following command line installation options.

The examples below use the file named vcredist_x86.exe, but you can substitute the x64 or ia64 versions of the EXEs with equivalent command lines to achieve the same behavior for them as well.

Silent install

This option will suppress all UI and perform an install.

<full path>\vcredist_x86.exe /q /norestart

For example, if you download vcredist_x86.exe to a folder named c:\vc2010redist, then the command line would look like this:

c:\vc2010redist\vcredist_x86.exe /q /norestart

Unattended install

This option will display a progress dialog (but requires no user interaction) and perform an install.

<full path>\vcredist_x86.exe /passive /norestart

For example, if you download vcredist_x86.exe to a folder named c:\vc2010redist, then the command line would look like this:

c:\vc2010redist\vcredist_x86.exe /passive /norestart

Silent repair

This option will suppress all UI and perform a repair.

<full path>\vcredist_x86.exe /q /repair /norestart

For example, if you download vcredist_x86.exe to a folder named c:\vc2010redist, then the command line would look like this:

c:\vc2010redist\vcredist_x86.exe /q /repair /norestart

Silent uninstall

This option will suppress all UI and perform an uninstall.

<full path>\vcredist_x86.exe /q /uninstall /norestart

For example, if you download vcredist_x86.exe to a folder named c:\vc2010redist, then the command line would look like this:

c:\vc2010redist\vcredist_x86.exe /q /uninstall /norestart

A note about reboots

All of the examples above use the /norestart switch to suppress reboots after the setup process completes.  The /norestart switch does not eliminate the need to reboot entirely – it just gives the calling process control over when to schedule the reboot if one is needed due to files being in use during setup.  If you run the Visual C++ 2010 redistributable setup and use the /norestart switch, you must check the exit code returned by the setup process and handle it accordingly in the calling process.  Here are the possible exit codes:

  • Exit code 0 means that setup succeeded and no reboot is needed.
  • Exit code 3010 means that setup succeeded and a reboot is needed to complete installation.
  • Any other exit code means that setup failed.

Related link

  • Thanks for posting this, useful information. On the other hand, if you have the right connections, please let the build engineers know about the idea that the following naming convention might not be the best one: name of vc++ 2005 redist package: vcredist_x86.exe; name of vc++ 2008 redist package: vcredist_x86.exe; name of vc++ 2010 redist package: vcredist_x86.exe.

  • Hi Daniel Szabo - I'm not sure I understand your feedback.  Are you suggesting that each version should have a unique name or something like that (vc2005redist_x86.exe, vc2008redist_x86.exe, etc)?  I think the best way to provide that type of feedback would be for you to post a suggestion on the Connect site at connect.microsoft.com/visualstudio.

  • Hi! Thanks for the link (and yes, unique naming for each release would be great). I will try contacting them (I have other exotic questions to them like why don't they manage to put each new vc++ library into the windows update system but you're right - this has nothing to do with you) Keep up the good posts!

  • Why should they? VS is not part of windows. Next thing you know Borland/"whatever they are called today" want their runtimes on windows update

  • Thanks Aaron for providing usefull info for installing VC++ 2010, Do we require windows installer for installing redistributable?.

    In the project currently I'm working it installs Windows Installer for installing VC++ 2005 redistributable. I'm not sure for installing VC++ 2010 redistributable MSI requires or not.

  • Hi Madhur - All versions of the Visual C++ Redistributable are packaged as .msi files, so they all require a version of Windows Installer in order to be able to install successfully.  The VC++ 2010 Redistributable requires at least Windows Installer 2.0, and that comes as a part of Windows on each of the versions of Windows that the VC++ 2010 Redistributable supports.  As a result, you don't need to worry about installing Windows Installer before trying to install the VC++ 2010 Redistributable.

  • Thanks Aaron!! Actually when we were installing VC8 redistributable that time we installed windows installer 3.1.

    So as per your suggestion we don't have to worry regarding installer.

  • Hi Aaron, Can we know programmatically which specific version of redistributables is used? I mean suppose VC10 RTLs releases a new version in future then how can we read, because "Installed" DWORD under \\Software\\Microsoft\\VisualStudio\\10.0\\VC\\VCRedist\\x86 gives whether VC10 Redistributables are installed or not; but not give specific version. Any help is appreciable.

  • Hi Madhur - There is a Version value under that registry sub-key, and it has different values for the original release of the Visual C++ Redistributable and for the SP1 beta that is currently available.  You would have to create a custom action to parse this Version registry value though, so if your application requires a specific version of the redistributable, it might be best to check for the install state of that exact redistributable MSI instead of relying on this registry key.  You can do that by using Windows Installer APIs or by checking for the product code under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{productcode}.

  • Thanks Aaron for responding!!

    When I tried to install VCRT 10 at PC that has no VS2010 installation and Windows XP Service Pack 3

    It installs under C:\Windows\System32 folder and registers under registry. So programmatically checking out at \\Software\\Microsoft\\VisualStudio\\10.0\\VC\\VCRedist\\x86 is ruled out.

    When I tried to install at PC where no VS 2010 and SP3 (i.e. WIN XP SP2) then it has given following message

    ---------------------------

    Microsoft Visual C++ 2010  x86 Redistributable Setup

    ---------------------------

    Windows Installer version 3.1 or higher is required to perform this installation. Please visit support.microsoft.com to obtain the appropriate version of Windows Installer 3.1 for your system.

    ---------------------------

    OK  

    ---------------------------

    So, it requires minimum WIN-XP SP3 or WIN-XP SP2 + Windows Installer 3.1 (Minimum) so it will not work with Windows Installer 2.0

    Now my task is to find out whether VC10 RTLs are installed or not

    In VC8 we are checking by whether ATL80.dll exist or not at C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_XXXXXXXXXX\ATL.dll

    where XXXXXX is Version String e.g.C:\WINDOWS\WinSxS\x86_Microsoft.VC80.ATL_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_6e805841 folder,

    so it is giving specific version for RTLs but in VC10 it is copying at System32 folder without specific to any version.

    I'm not sure in future MS will follow same pattern as in VC8 but right now it is copying at System32 folder so it appears that we can check by registry entry.

    Aaron, any help is appreciable.

  • Hi Aaron, I've verified it is making entry in registry at \\Software\\Microsoft\\VisualStudio\\10.0\\VC\\VCRedist\\x86 at PC that does not have VS 2010, so it can be used but as per your suggession I can read particular .msi file from

    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{productcode}, I'll try this one and check whether up to what extent it can give information e.g. version, which service pack etc.. Thanks Aaron for your all around help

  • Hi Madhur - I'm sorry I provided incorrect information earlier about the version of Windows Installer that is required by the VC++ redistributable.  I looked at the schema in the MSI in Orca, and it says 200, but I didn't look at what the setup bootstrapper is checking for.  You will need to make sure that Windows Installer 3.1 or higher is installed on any computers that you install the VC++ 2010 Redistributable on.

    The VC++ 2010 runtime files install to the system directory (instead of to the WinSxS directory used by previous versions of the VC++ runtime files).  As a result, if you're going to perform a file version check, you'll need to check in the system directory.  The registry-based check for the redistributable MSI should also work in this type of scenario if you'd prefer.

  • Hi Aaron, No probs for installer and no need to feel sorry..How can we verify whether Visual C++ 2010 Redistributable supports Side by Side installation (i.e. multiple versions exist)

  • Hi Madhur - I'm not sure about this side-by-side question yet.  For now, you can try to examine the VC++ 2010 SP1 beta redistributable that is available at www.microsoft.com/.../details.aspx and see if it supports side-by-side installation with the original version of the VC++ 2010 redistributable.

    Keep in mind that this is a beta though, so the behavior you see may not be the same in the final SP1 release.

  • Thanks Aaron for quick response..I mean for side by side installation in VCRT8 it was creating separate folders for each version and keeping dll inside that, but in VCRT10 if it is copying System 32 folder but I've just tried with VCRT10 SP1 Beta installation and it has overridden earlier installation so it is not keeping both versions.

    As my application is to move VC8 to VC10 and dotnet 2.0 to 4.0 so need to maintain side by side functionality by installing multiple versions.

    The registry-based check for the redistributable MSI should also work in this type of scenario - Can you please litte explore or give me link where I can see some sample code for this?

Page 1 of 3 (45 items) 123
Leave a Comment
  • Please add 2 and 5 and type the answer here:
  • Post