views:

402

answers:

1

We have an app compiled using MSVC 2K5, SP1 (version 762 msvcrt80)

All is well, right up until somebody installs on the same machine .Net3.0SP1, and along with it msvcrt80 version 1433 is installed and a policy to automatically upgrade.

Now we have random crashes all over the place and unhappy customers.

I understand we can adjust our manifest files to force the usage of a specific version, but I've only found the really ugly way of copying detail that is auto generated and modifying it by hand. This is especially unpleasant with a large number of apps to fix

Can we instead get rid of the stupid 'upgrade' policy in the winSxS directory? Is there an option/flag to compile for a specific version only and still automatically generate the manifests?

A: 

Find the generated manifest for your specific version of the CRT. Then add a pragma to the main file of your application:

#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
        "processorArchitecture='x86' "                                  \
        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
Stefan