Visual C++ Redistributables without using VCRedist_x86.exe
Asked Answered
S

4

15

I'm developing in an environment that is severely constrained, but the developers also have tight control over.

VCRedist_x86.exe - A 4Mb redistributable - is no fun (four hours to transfer). I'd really prefer to just redistribute MFC90.dll, msvcm90.dll, msvcp90.dll and msvcr90.dll - that's more like 2Mb. However, Redistributing Visual C++ Files says:

It is not supported to redistribute C/C++ applications that are built without a manifest. Visual C++ libraries cannot be used by C/C++ applications without a manifest binding the application to these libraries. For more information, see Choosing a Deployment Method.

My original plan of copying the DLLs into the program's working directory doesn't seem to work in this brave new world of manifests.

My next guess is to bodge up the registry entries required to populate the files into the WinSxS directory and populate it myself (rather than using the 4 meg program).

[edit] The software is frequently updated, so DLLs are strongly preferred to static linking. [/edit]

How can I sucessfully distribute the necessary files but keep the overhead down?

Selfhood answered 7/10, 2008 at 2:17 Comment(0)
D
13

We use this: Howto: Deploy VC2008 apps without installing vcredist_x86.exe

Essentially

  • Don't embed a manifest in your exe files.
  • Copy the C++ DLLs and their manifests to your app's directory.
  • Remove the "publicKeyToken" from all manifests (yours and Microsoft's).
  • If necessary, change the version info in your app's manifest files to match the Microsoft manifest files (or vice versa)
Dorthadorthea answered 7/10, 2008 at 3:5 Comment(0)
L
27

[I'm the current SxS maintainer at Microsoft]

I would strongly suggest against removing the publicKeyToken attribute from manifests. Private deployment of the dlls will work just fine with this attribute left intact. However, removing it will prevent your app from benefiting from security updates should there be a newer version of the CRT installed centrally on the target machine, as the dependencies will no longer match up.

So, to summarize: it's safe to embed your manifest, with the default. Copy the CRT manifest + DLL files directly into your executable's directory, with no edits. That's it. Compatible Win2k+.

Lustring answered 6/11, 2008 at 7:24 Comment(1)
Hi Eugene: Are you saying that if you deploy your app with local CRT/MFC/etc DLLs and manifest files, that Windows updates that affect these files will somehow find them in your install dir and update them?!?!Pazpaza
D
13

We use this: Howto: Deploy VC2008 apps without installing vcredist_x86.exe

Essentially

  • Don't embed a manifest in your exe files.
  • Copy the C++ DLLs and their manifests to your app's directory.
  • Remove the "publicKeyToken" from all manifests (yours and Microsoft's).
  • If necessary, change the version info in your app's manifest files to match the Microsoft manifest files (or vice versa)
Dorthadorthea answered 7/10, 2008 at 3:5 Comment(0)
H
4

Specify /MT (Multithreaded) for the "runtime library" setting in the compiler property page. This statically links against the runtime library so you don't have to install the redistributable.

Horde answered 7/10, 2008 at 2:21 Comment(0)
J
1

Install them as private assemblies. See here:

http://msdn.microsoft.com/en-us/library/ms235291.aspx

Note that if you don't need all of the DLLs provided you can modify the manifest files to only reference the ones you need.

Juggle answered 7/10, 2008 at 2:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.