ClickOnce with Visual C++ 2010 Runtime Libraries (x86) Prerequisite

This article applies to Visual Studio 2010 SP1.

ClickOnce provides a nice utility to include prerequisites in the deployment. But the VC++ Runtime x86 shipped with VS is bugged. As a result, the ClickOnce installer will try to download and install the VC++ Runtime all the time. And most of the times, this installation will fail because it finds that a newer version has already been installed.

There are in fact two things going wrong here:

1) The installer tries to detect the installed VC++ Runtime with a wrong product code. So when it cannot find the wrong code, it thinks the VC++ Runtime is not installed and tries to download one.

2) It uses a wrong download link to download the older version of the runtime, which would fail if you already has a newer one.

Fixes:

1) Go to C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\vcredist_x86\product.xml. Find this section:

<InstallChecks>
 <MsiProductCheck Property="VCRedistInstalled" Product="{6EE91C1A-A2E7-38CD-AEBB-3B900A4D8868}"/>
</InstallChecks>

The product code needs to be changed to {F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}.

2) Go to C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\vcredist_x86\en\package.xml. Find this section:

<String Name="VCRedistExe">http://go.microsoft.com/fwlink/?LinkID=177916&amp;clcid=0x409</String>

The LinkID needs to be changed to 210621.

 

references:

http://stackoverflow.com/questions/7785328/visual-c-2010-runtime-libraries-prerequisite-keeps-popping-up-on-a-vs-2010-cre

https://connect.microsoft.com/VisualStudio/feedback/details/726264/msdn-forum-vcredist-x86-bootstrapper-package-xml-content-wrong