50% OFF!!!

Wednesday, November 24, 2010

Bootstrapper Package | detect vcredist installed | Microsoft Visual C++ 2008 SP1 Redistributable Package

As a countinue post of my previous http://mdb-blog.blogspot.com/2010/11/bootstrapper-package-visual-studio-2010.html about Bootstrapper Package ( Visual Studio 2010) of Microsoft .NET Framework Version 2.0 Redistributable, i give an example for:
Bootstrapper Package for Microsoft Visual C++ 2008 SP1 Redistributable Package
(also known as Visual C++ 9.0 runtime redistributable package)

As I searched for many sites, I couldn't find any GOOD article about detecting this resi package.
So, I built a bootstrapper package using the information I found on Aaron's post: "How to detect the presence of the Visual C++ 9.0 runtime redistributable package" at http://blogs.msdn.com/b/astebner/archive/2009/01/29/9384143.aspx.

First of all, we have to detect if one of (vcredist_x86, vcredist_x64, vcredist_IA64) is INSTALLED!
To do so, we will use the MsiQueryProductState API inside our Product.xml in the bootstrapper package folder. (for more information about bootstrapper package files watch my previous post.
Because there is a difference in the Product-Code between the localized versions of the redistributables for VC++ 2008, i checked and write down all the product codes in the following table:

vcredist_x86.exeProductCode
English{9A25302D-30C0-39D9-BD6F-21E6EC160475}
ChineseSimplified{86CE1746-9EFF-3C9C-8755-81EA8903AC34}
ChineseTraditional{CA8A885F-E95B-3FC6-BB91-F4D9377C7686}
French{820B6609-4C97-3A2B-B644-573B06A0F0CC}
German{6AFCA4E1-9B78-3640-8F72-A7BF33448200}
Italian{F03CB3EF-DC16-35CE-B3C1-C68EA09E5E97}
Japanese{402ED4A1-8F5B-387A-8688-997ABF58B8F2}
Korean{887868A2-D6DE-3255-AA92-AA0B5A59B874}
Russian{527BBE2F-1FED-3D8B-91CB-4DB0F838E69E}
Spanish{57660847-B1F7-35BD-9118-F62EB863A598}
UpgradeCode for all {AA783A14-A7A3-3D33-95F0-9A351D530011}

vcredist_x64.exeProductCode
English{8220EEFE-38CD-377E-8595-13398D740ACE}
ChineseSimplified{56F27690-F6EA-3356-980A-02BA379506EE}
ChineseTraditional{14297226-E0A0-3781-8911-E9D529552663}
French{9B3F0A88-790D-3AD9-9F96-B19CF2746452}
German{D285FC5F-3021-32E9-9C59-24CA325BDC5C}
Italian{092EE08C-60DE-3FE6-B113-90076EC06D0D}
Japanese{A96702F7-EFC8-3EED-BE46-22C809D4EBE5}
Korean{92B8FD1F-C1AE-3750-8577-631B0AA85DF5}
Russian{2DFD8316-9EF1-3210-908C-4CB61961C1AC}
Spanish{E34002C7-8CE7-3F76-B36C-09FA973BC4F6}
UpgradeCode for all {AA783A14-A7A3-3D33-95F0-9A351D530011}

vcredist_IA64.exeProductCode
English{5827ECE1-AEB0-328E-B813-6FC68622C1F9}
ChineseSimplified{9363B366-8370-34F7-8164-25052EBF35FD}
ChineseTraditional{4EC84186-70BB-3121-9C1B-C63512D7126E}
French{1F7B9797-A3C8-3B98-85C4-00620F221CE8}
German{6BE0A7C7-3462-30EE-8B77-D21D7848D967}
Italian{BF58DC07-38AB-3887-8000-70173F9650EA}
Japanese{D289009A-2728-3D0A-833E-F08E0E58934C}
Korean{9476DC14-00C3-3C36-A435-00D714CF77B8}
Russian[Installer NOT exists!]
Spanish{678835D7-D524-3C0E-9C33-1D3767FDA6BF}
UpgradeCode for all {AA783A14-A7A3-3D33-95F0-9A351D530011}


All left is to create the bootstrapper folder (name it Vcredist2008sp1):
(*) en (FOLDER)
    (*) package.xml
(*) Product.xml
(*) redist.txt
(*) vcredist_x86.exe (download here)
(*) vcredist_x64.exe (download here)
(*) vcredist_IA64.exe (download here)


package.xml file:
<?xml version="1.0" encoding="utf-8"?>
<Package Name="DisplayName" Culture="Culture" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
  <Strings>
    <String Name="Culture">en</String>
    <String Name="DisplayName">Microsoft Visual C++ 2008 SP1 Redistributable Package</String>
    <String Name="AdminRequired">Administrator permissions are required to install the Microsoft Visual C++ 2008 SP1 Redistributable Package Contact your administrator.</String>
    <String Name="CancelledInstall">The user has cancelled the installation. The Microsoft Visual C++ 2008 SP1 Redistributable Package has not been installed.</String>
    <String Name="GeneralFailure">A failure occurred attempting to install the Microsoft Visual C++ 2008 SP1 Redistributable Package.</String>
    <String Name="ErrorDownloading">A failure occurred while downloading Microsoft Visual C++ 2008 SP1 Redistributable Package.</String>
  </Strings>
</Package>

Product.xml file:
1. PackageFiles (installation files):
<PackageFiles CopyAllPackageFiles="false">
  <PackageFile Name="vcredist_x86.exe" />
  <PackageFile Name="vcredist_x64.exe" />
  <PackageFile Name="vcredist_IA64.exe" />
</PackageFiles>

2. InstallChecks (valiadation prefurmed):
<InstallChecks>
  <!--VCRedistx86 - ProductCodes-->
  <MsiProductCheck Property="VCRedistx86_English_Installed" Product="{9A25302D-30C0-39D9-BD6F-21E6EC160475}" />
  <MsiProductCheck Property="VCRedistx86_ChineseSimplified_Installed" Product="{86CE1746-9EFF-3C9C-8755-81EA8903AC34}" />
  <MsiProductCheck Property="VCRedistx86_ChineseTraditional_Installed" Product="{CA8A885F-E95B-3FC6-BB91-F4D9377C7686}" />
  <MsiProductCheck Property="VCRedistx86_French_Installed" Product="{820B6609-4C97-3A2B-B644-573B06A0F0CC}" />
  <MsiProductCheck Property="VCRedistx86_German_Installed" Product="{6AFCA4E1-9B78-3640-8F72-A7BF33448200}" />
  <MsiProductCheck Property="VCRedistx86_Italian_Installed" Product="{F03CB3EF-DC16-35CE-B3C1-C68EA09E5E97}" />
  <MsiProductCheck Property="VCRedistx86_Japanese_Installed" Product="{402ED4A1-8F5B-387A-8688-997ABF58B8F2}" />
  <MsiProductCheck Property="VCRedistx86_Korean_Installed" Product="{887868A2-D6DE-3255-AA92-AA0B5A59B874}" />
  <MsiProductCheck Property="VCRedistx86_Russian_Installed" Product="{527BBE2F-1FED-3D8B-91CB-4DB0F838E69E}" />
  <MsiProductCheck Property="VCRedistx86_Spanish_Installed" Product="{57660847-B1F7-35BD-9118-F62EB863A598}" />

  <!--VCRedistx64 - ProductCodes-->
  <MsiProductCheck Property="VCRedistx64_English_Installed" Product="{8220EEFE-38CD-377E-8595-13398D740ACE}" />
  <MsiProductCheck Property="VCRedistx64_ChineseSimplified_Installed" Product="{56F27690-F6EA-3356-980A-02BA379506EE}" />
  <MsiProductCheck Property="VCRedistx64_ChineseTraditional_Installed" Product="{14297226-E0A0-3781-8911-E9D529552663}" />
  <MsiProductCheck Property="VCRedistx64_French_Installed" Product="{9B3F0A88-790D-3AD9-9F96-B19CF2746452}" />
  <MsiProductCheck Property="VCRedistx64_German_Installed" Product="{D285FC5F-3021-32E9-9C59-24CA325BDC5C}" />
  <MsiProductCheck Property="VCRedistx64_Italian_Installed" Product="{092EE08C-60DE-3FE6-B113-90076EC06D0D}" />
  <MsiProductCheck Property="VCRedistx64_Japanese_Installed" Product="{A96702F7-EFC8-3EED-BE46-22C809D4EBE5}" />
  <MsiProductCheck Property="VCRedistx64_Korean_Installed" Product="{92B8FD1F-C1AE-3750-8577-631B0AA85DF5}" />
  <MsiProductCheck Property="VCRedistx64_Russian_Installed" Product="{2DFD8316-9EF1-3210-908C-4CB61961C1AC}" />
  <MsiProductCheck Property="VCRedistx64_Spanish_Installed" Product="{E34002C7-8CE7-3F76-B36C-09FA973BC4F6}" />

  <!--VCRedistIA64 - ProductCodes-->
  <MsiProductCheck Property="VCRedistIA64_English_Installed" Product="{5827ECE1-AEB0-328E-B813-6FC68622C1F9}" />
  <MsiProductCheck Property="VCRedistIA64_ChineseSimplified_Installed" Product="{9363B366-8370-34F7-8164-25052EBF35FD}" />
  <MsiProductCheck Property="VCRedistIA64_ChineseTraditional_Installed" Product="{4EC84186-70BB-3121-9C1B-C63512D7126E}" />
  <MsiProductCheck Property="VCRedistIA64_French_Installed" Product="{1F7B9797-A3C8-3B98-85C4-00620F221CE8}" />
  <MsiProductCheck Property="VCRedistIA64_German_Installed" Product="{6BE0A7C7-3462-30EE-8B77-D21D7848D967}" />
  <MsiProductCheck Property="VCRedistIA64_Italian_Installed" Product="{BF58DC07-38AB-3887-8000-70173F9650EA}" />
  <MsiProductCheck Property="VCRedistIA64_Japanese_Installed" Product="{D289009A-2728-3D0A-833E-F08E0E58934C}" />
  <MsiProductCheck Property="VCRedistIA64_Korean_Installed" Product="{9476DC14-00C3-3C36-A435-00D714CF77B8}" />
  <!--RUSSIAN installer not exists -->
  <MsiProductCheck Property="VCRedistIA64_Spanish_Installed" Product="{678835D7-D524-3C0E-9C33-1D3767FDA6BF}" />
</InstallChecks>

3. for each installation check if any localized installed:
<BypassIf Property="VCRedistx86_English_Installed" Compare="ValueEqualTo" Value="5" />
<BypassIf Property="VCRedistx86_ChineseSimplified_Installed" Compare="ValueEqualTo" Value="5" />
<BypassIf Property="VCRedistx86_ChineseTraditional_Installed" Compare="ValueEqualTo" Value="5" />
<BypassIf Property="VCRedistx86_French_Installed" Compare="ValueEqualTo" Value="5" />
<BypassIf Property="VCRedistx86_German_Installed" Compare="ValueEqualTo" Value="5" />
<BypassIf Property="VCRedistx86_Italian_Installed" Compare="ValueEqualTo" Value="5" />
<BypassIf Property="VCRedistx86_Japanese_Installed" Compare="ValueEqualTo" Value="5" />
<BypassIf Property="VCRedistx86_Korean_Installed" Compare="ValueEqualTo" Value="5" />
<BypassIf Property="VCRedistx86_Russian_Installed" Compare="ValueEqualTo" Value="5" />
<BypassIf Property="VCRedistx86_Spanish_Installed" Compare="ValueEqualTo" Value="5" />

Download link for the full bootstrapper package is here:
download full package here

Hope it helps,
MDB-Blog

5 comments:

  1. hello,

    can you please tell me, can I implement this boottrapper in WIX ?

    ReplyDelete
  2. This is really great! But I'm trying to do the same thing for the Visual C++ Redistributable for Visual Studio 2012. I assume it will be pretty much the same thing except different product codes. Do you know where I can get the Product Codes for VC++ 2012? Thanks!

    ReplyDelete
  3. I can not download the full package. Could you update the link? thx

    ReplyDelete