Howto: Deploy VC2008 apps without installing vcredist_x86.exe

原创 2017年08月04日 22:03:20

There are several reasons for xcopy deployment of an application (also known as application local). One main reason is that you are independent of what the target computer has installed.

Also your application always uses the “correct” (or better: tested) version of DLLs, regardless of what MS installed or updated (see: .NET2 SP1 update breaks old apps!?).

The easiest way to overcome the problem is to link static against the CRT/MFC. But in some scenarios this is not an option and not possible.

But to be independent from OS updates or from vcredist_x86.exe installations of other apps, you need to do the following steps:

  • Remove the auto-generation of manifests (from all DLLs) and change the manifest generation form your EXE to an external manifest; you can do this by choosing: Project|Properties|Configuration Properties|Manifest Tool|Input and Output|Embed Manifest: No
  • Recompile your application and modify the external manifest as follows:
  • Copy your application and the external manifest to your deployment directory
  • Open the manifest-file (appname.exe.manifest) and remove the “publicKeyToken” from all MFC/CRT/ATL/OpenMP entries. Please leave the publicKeyToken to the “Microsoft.Windows.Common-Controls” entry.
  • Copy all neccessary directories under %ProgramFiles%\Microsoft Visual Studio 9.0\VC\redist\x86 to your deployment directory
  • In all sub-directories (Microsoft.VC90.CRT, optional: Microsoft.VC90.MFC, Microsoft.VC90.ATL, Microsoft.VC90.OPENMP, Microsoft.VC90.MFCLOC) open the manifest-file and also remove the publicKeyToken
  • Also lookup the version info from these manifest files and correct the version-info of the corresponding entries in your application manifest file
  • Save all manifests and let your program run; it should now run on all supported OS without installing anything…

After doing all these manifest stuff you can also embed the manifest into your application (EXE). And of course: The same can be done with x64 and IA64 apps.

I have made an example of the default MFC app (4.6 MB) for reference.

The (simple) manifests for the new MFC feature pack and the application looks like:

 

Application.exe.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel> </requestedPrivileges> </security> </trustInfo> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30411.0" processorArchitecture="x86"></assemblyIdentity> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.VC90.MFC" version="9.0.30411.0" processorArchitecture="x86"></assemblyIdentity> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity> </dependentAssembly> </dependency></assembly>

 Microsoft.VC90.CRT.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <noInheritable /> <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30411.0" processorArchitecture="x86" /> <file name="msvcr90.dll" /> <file name="msvcp90.dll" /> <file name="msvcm90.dll" /></assembly>

Microsoft.VC90.MFC.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <noInheritable /> <assemblyIdentity type="win32" name="Microsoft.VC90.MFC" version="9.0.30411.0" processorArchitecture="x86" /> <file name="mfc90.dll" /> <file name="mfc90u.dll" /> <file name="mfcm90.dll" /> <file name="mfcm90u.dll" /></assembly>

Instead of putting the “Microsoft.VC90.MFC” and “Microsoft.VC90.CRT” directories into the application folder, you can also just put the files from these folders into the application directory. The main advantage is, that your app will also work on W2k-SP4.

 

出处:

http://blog.kalmbach-software.de/2008/05/03/howto-deploy-vc2008-apps-without-installing-vcredist_x86exe/

Howto: Deploy VC2008 apps without installing vcredist_x86.exe

There are several reasons for xcopy deployment of an application (also known as application local). ...
  • WuErPing
  • WuErPing
  • 2009年02月15日 10:14
  • 5229

[原创] Cygwin完全下载指南(上)-正常下载篇

    本人为了学习标准C++,偶选择了眼下如日中天的Eclipse做为IDE,为了让Clipse支持C++开发,除了要下载个CDT插件外,就是要下载并安装Cygwin(或者MingW)了。岂料Cyg...
  • Lionwoo
  • Lionwoo
  • 2005年08月06日 04:01
  • 22967

vs2008编译出来的程序不能运行或需要安装vcredist_x86.exe才能运行解决办法

Howto: Deploy VC2008 apps without installing vcredist_x86.exe There are several reasons for xcopy d...
  • doumin
  • doumin
  • 2011年11月14日 14:33
  • 1008

无法安装vcredist_x86.exe, 提示无法访问Windows Installer服务

无法安装vcredist_x86.exe, 提示无法访问Windows Installer服务近期遇到一个客户在安装客户端软件的时候,无法安装打包在一起的vcredist_x86.exe,提示内容中的...
  • HuaHuaXia
  • HuaHuaXia
  • 2015年06月05日 11:40
  • 3907

How to install Google Apps (GApps) on your Android Device / Phone

http://senk9.wordpress.com/2010/12/03/how-to-install-google-apps-gapps-on-your-android-device-phone/...
  • frank2336
  • frank2336
  • 2011年10月20日 14:20
  • 9131

Android安装APK出现DELETE_FAILED_INTERNAL_ERROR,Error while Installing APKs

新版本Android Studio运行APK时,出现DELETE_FAILED_INTERNAL_ERROR, Error while Installing APKs如何解决。 有一种方法:打开se...
  • xjj19920608
  • xjj19920608
  • 2017年04月21日 22:36
  • 2083

静默安装vcredist_x86.exe

cmd命令:start /wait vcredist_x86/vcredist_x86.exe /q /norestart start /wait DotNetFx40/dotNetFx40_Fu...
  • liukang325
  • liukang325
  • 2016年12月06日 14:25
  • 979

deploy tornado apps within nginx

tornado apps listen port: 8888 nginx conf file: user root; worker_processes 1; error_log logs/err...
  • purplefox123
  • purplefox123
  • 2011年12月20日 13:03
  • 251

HowTo: iOS Apps - Static analysis

http://blog.dornea.nu/2014/10/29/howto-ios-apps-static-analysis/ In this short article I'll...
  • fg313071405
  • fg313071405
  • 2014年12月11日 10:33
  • 1171

vcredist_x86.exe 静默安装方法

我们打包基于VC++开发的应用程序,我们会一同打包一个VC运行库,否则安装到一些非开发环境中,你的应用程序依然可以正确运行。 Visual C++ 2008 Redistributable Pack...
  • bible521125
  • bible521125
  • 2014年08月25日 10:31
  • 3481
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Howto: Deploy VC2008 apps without installing vcredist_x86.exe
举报原因:
原因补充:

(最多只允许输入30个字)