Chris Becke
2010-03-29 13:34:44 UTC
Visual Studio 9 seems to have two parallel, but conflicting systems, for
defining the CRT assembly to link in.
With VS9 SP1 installed:
_BIND_TO_CURRENT_CRT version drives the definition of
_CRT_ASSEMBLY_VERSION, which is used in a #pragma to set a
/manifestdependency linker option.
// snip from crtassem.h
#ifndef _CRT_ASSEMBLY_VERSION
#if _BIND_TO_CURRENT_CRT_VERSION
#define _CRT_ASSEMBLY_VERSION "9.0.30729.1"
#else
#define _CRT_ASSEMBLY_VERSION "9.0.21022.8"
#endif
#endif
It ALSO drives the inclusion of a #pragma that does a /INCLUDE on
_forceCRTManifestRTM or _forceCRTManifestCUR - which link in object code
containing an embedded /manifestdependency entry.
Now, the problem is, There was a security fix, and the current version
of the VC9 runtime is "9.0.30729.4148".
We added '_CRT_ASSEMBLY_VERSION=\"9.0.30729.4148\"' to our project
settings, which causes the resulting app manifest to contain references
to both the 9.0.21022.8 AND 9.0.30729.4148 runtimes.
(Setting _BIND_TO_CURRENT_CRT_VERSION just changes the problem to be
both 9.0.30729.1 and 9.0.30729.4148).
The only way to "fix" this issue so far is to add
extern "C" int _forceCRTManifestRTM=0;
extern "C" int _forceCRTManifestCUR=0;
to one of our cpp files to ... unforce the inclusion of the cpp files
containing the dodgey #pragma's.
The other option is to turn off manifest generation, and simply include
a hand crafted one, but given the number of settings in manifests
nowadays that are configured via property pages, bypassing the
generation seems a very bad long term solution.
It is important to us to have the manifest file explicitly ask for the
4148 build as we are shipping the runtime as a private assembly, and we
obviously want to ship the latest version. (Version checks are done for
private assemblies.)
Am I missing something, or is this hackish solution really the only way
to get the generated manifests to link vs the correct "Microsoft.VC90"
assembly?
defining the CRT assembly to link in.
With VS9 SP1 installed:
_BIND_TO_CURRENT_CRT version drives the definition of
_CRT_ASSEMBLY_VERSION, which is used in a #pragma to set a
/manifestdependency linker option.
// snip from crtassem.h
#ifndef _CRT_ASSEMBLY_VERSION
#if _BIND_TO_CURRENT_CRT_VERSION
#define _CRT_ASSEMBLY_VERSION "9.0.30729.1"
#else
#define _CRT_ASSEMBLY_VERSION "9.0.21022.8"
#endif
#endif
It ALSO drives the inclusion of a #pragma that does a /INCLUDE on
_forceCRTManifestRTM or _forceCRTManifestCUR - which link in object code
containing an embedded /manifestdependency entry.
Now, the problem is, There was a security fix, and the current version
of the VC9 runtime is "9.0.30729.4148".
We added '_CRT_ASSEMBLY_VERSION=\"9.0.30729.4148\"' to our project
settings, which causes the resulting app manifest to contain references
to both the 9.0.21022.8 AND 9.0.30729.4148 runtimes.
(Setting _BIND_TO_CURRENT_CRT_VERSION just changes the problem to be
both 9.0.30729.1 and 9.0.30729.4148).
The only way to "fix" this issue so far is to add
extern "C" int _forceCRTManifestRTM=0;
extern "C" int _forceCRTManifestCUR=0;
to one of our cpp files to ... unforce the inclusion of the cpp files
containing the dodgey #pragma's.
The other option is to turn off manifest generation, and simply include
a hand crafted one, but given the number of settings in manifests
nowadays that are configured via property pages, bypassing the
generation seems a very bad long term solution.
It is important to us to have the manifest file explicitly ask for the
4148 build as we are shipping the runtime as a private assembly, and we
obviously want to ship the latest version. (Version checks are done for
private assemblies.)
Am I missing something, or is this hackish solution really the only way
to get the generated manifests to link vs the correct "Microsoft.VC90"
assembly?