Question

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?

Was it helpful?

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.

OTHER TIPS

I believe you can open the manifest file for your app and modify the versions of the redists your app should be linking against. The listings in the manifest should match what you have in your C:\Windows\WinSxS dirs. There is a CodeProject page that gives a good description of using different redistributables.

I just installed Visual Studio 2005. Here is an original bootstrapper:

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86\

\en\package.xml

<?xml version="1.0" encoding="utf-8" ?>

<Package
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  Name="DisplayName"
  Culture="Culture"
>

    <!-- Defines a localizable string table for error messages-->
    <Strings>
        <String Name="DisplayName">Visual C++ Runtime Libraries (x86)</String>
        <String Name="Culture">en</String>
        <String Name="AdminRequired">You do not have the permissions required to install Visual C++ Runtime Libraries (x86). Please contact your administrator.</String>
        <String Name="InvalidPlatformWin9x">Installation of Visual C++ Runtime Libraries (x86) is not supported on Windows 95. Contact your application vendor.</String>
        <String Name="InvalidPlatformWinNT">Installation of Visual C++ Runtime Libraries (x86) is not supported on Windows NT 4.0. Contact your application vendor.</String>
        <String Name="GeneralFailure">A failure occurred attempting to install Visual C++ Runtime Libraries (x86).</String>
    </Strings>

</Package>

\product.xml

<?xml version="1.0" encoding="utf-8" ?> 

<Product
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  ProductCode="Microsoft.Visual.C++.8.0.x86"
>

  <!-- Defines list of files to be copied on build -->
  <PackageFiles>
    <PackageFile Name="vcredist_x86.exe"/>
  </PackageFiles>

  <InstallChecks>
    <MsiProductCheck Property="VCRedistInstalled" Product="{A49F249F-0C91-497F-86DF-B2585E8E76B7}"/>
  </InstallChecks>

  <!-- Defines how to invoke the setup for the Visual C++ 8.0 redist -->
  <!-- TODO: Needs EstrimatedTempSpace, LogFile, and an update of EstimatedDiskSpace -->
  <Commands Reboot="Defer">
    <Command PackageFile="vcredist_x86.exe" 
         Arguments=' /q:a ' 
         >

      <!-- These checks determine whether the package is to be installed -->
      <InstallConditions>
        <BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/>
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>

        <!-- Block install on Win95 -->
        <FailIf Property="Version9X" Compare="VersionLessThan" Value="4.10" String="InvalidPlatformWin9x"/>

        <!-- Block install on NT 4 or less -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/>

      </InstallConditions>

      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>

    </Command>
  </Commands>
</Product>

\vcredist_x86.exe

SHA1: 95040f80b0d203e1abaec4e06e0ec0e01c507d03
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top