Search code examples
visual-c++clickonceversionsredistributableprerequisites

Specifying a VC++ Redistributable version for ClickOnce prerequisite


My ClickOnce application uses a third party tool that requires the Visual C++ 2005 redistributable. The third party tool will not work if only the VC++ 2008 redistributable is installed. However, in Visual Studio 2008, the ClickOnce prerequisites do not allow a version to be specified for the VC++ redistributable; it will add a VC++ 2008 prerequisite, which makes sense most of the time. However, in this situation, an earlier version is required. ClickOnce is required, so merge modules are out of the question. Any ideas of how to specify the version?


Solution

  • If you can find a machine with VS 2005 installed, the solution shouldn't be too hard. You have the ability to customize what appears in the Prerequisites dialog on the Publish tab of your project.

    1. On a machine with VS 2005 installed, go to \Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages and copy the vsredist_x86 folder to the machine you are publishing from.
    2. Rename the folder, call it vsredist_x86_2005 or something similar.
    3. Inside the folder, edit the \en\package.xml file. Change the <String Name="DisplayName"> tag to something that makes sense (Visual C++ 2005 Runtime Libraries (x86)) to differentiate it from the existing 2008 package.
    4. Copy the folder to C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages.
    5. Restart Visual Studio if it is open.

    Now, when you open the Prerequisites dialog you should see a new entry for the 2005 package. I didn't completely test this solution so I may have missed a few details but hopefully this gets you started.