views:

633

answers:

2

Is it possible in Visual Studio 2008 SP1 to target a C++ COM project to vcredist 2008 instead of vcredist 2008 SP1?

Our customers have the vcredist 2008 installed and we don't want to force them to install vcredist 2008 SP1. (thousands of computers!)

+1  A: 
  1. You can try to remove the embed manifest (look under the project settings Manifest Tool) and provide your own manifest for the application that targets the pre sp1 CRuntime versions.
  2. You can also deploy the C-Runtime yourself, in the redist folder under x86/x64 you will find the folder of the C-Runtime (Microsoft.VC90.CRT) just copy those folders in the same folder as your exe.
  3. Use the static C-Runtime option, so that the C-Runtime will be used as static lib, its useful if you don't have a lot of dll/exe.
Shay Erlichmen
I tried suggestion 1. The manifest that's created already looks like it targets pre SP1:<assemblyIdentity type="win32" name="Microsoft.VC90.ATL" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>But when I check with Dependency Walker it look like it's still depends on the 9.0.30729.1 (SP1) version of the file?
Jonas Rindberg
+1 to suggestion #3. It means the C runtime will actually be compiled into your executable. That will make the exe a bit larger, but will eliminate the need of any vcredist. And if the size does worry you, you can try using PGO to have the rarely used code pushed to the back seats of the exe.
eran
Using static libraries solved the problem
Jonas Rindberg
+2  A: 

VS2008 actually, by default, continues to target the VS9 RTM redist. What is happening in dependency checker is, when VS9 SP1 is installed, a policy file is also installed that redirects attempts to load the RTM redistributables to the SP1 redistributables.

In order to get VS9 SP1 to actually require the SP1 runtimes you need to add the following macro to your project settings or precompiled header:

#define _BIND_TO_CURRENT_CRT_VERSION 1
Chris Becke
With me, this has the effect that two versions of Microsoft.VC90.CRT are referred to within the manifest file.
Dimitri C.
This would happen if your project consists of any files that are being built as part of a different project. Are you using a pre-built static lib for example? Or have any kind of project dependency. All static libs would need to be rebuilt with the #define to ensure that every object file contains the exact same crt dependency information.
Chris Becke