转自:http://hi.baidu.com/_%E2d_%B7%B3_%DE%B2%C2%D2/blog/item/966d62db05519263d1164e3c.html
方法一:
!!“由于应用程序的配置不正确,应用程序未能启动,重新安装应用程序可能会纠正这个问题”的解决方案
第一步,什么设置都不用改,什么静态链接还是动态链接都不管了,什么多线程调试什么多线程也不管了,就用默认的配置属性。
第二步,找到你要发布的程序,COPY出来,相关度的资源也COPY到恰当的位置。
第三步,找到D:/Program Files/Microsoft Visual Studio 9.0/VC/redist/x86/Microsoft.VC90.CRT下面的四个文件,三个dll,一个manifest文件。。。我这里用2008来说,2005就自己推。。。,COPY他们四个到你的程序目录下面。
第四步,准备一个辅助包,
Visual Studio 2008的用户下这个:
http://download.microsoft.com/download/7/5/0/7502f4e9-1f90-4895-9259-1bde67b8b9a1/vcredist_x86.exe
Visual Studio 2005 sp1的用户下这个:
http://download.microsoft.com/download/7/9/8/798325b7-8993-4ef9-9148-8db9ff4187fc/vcredist_x86.exe
然后也放在你的程序目录下面。
第五步,拷贝这些所有东西到目标机器上,然后先安装第四步下载的玩意,再运行你的程序,Over。。。
如果不放心的话还可以多拷贝点东西,到时候再决定看哪些是不需要的,到时候再删除被,反正是学习,不要怕犯错误。。。
至于MFC啥的我没试,总之我的程序是成功了的。
方法二:
打开一看原来是一个xml文件,如下所示:
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.MFC' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*' />
</dependentAssembly>
</dependency>
</assembly>
</code>
乱糟糟的一堆,但是这个name比较有趣,似乎是应用程序所依赖的一些库的名字。
好,搜索一下,果然,找到了这些东西。这些依赖文件位于:
C:/Program Files/Microsoft Visual Studio 8/VC/redist/x86
这个目录下面,你会找到上面xml的item中列出来的Microsoft.VC80.CRT和Microsoft.VC80.MFC这两个目录。剩下的那个Microsoft.Windows.Common-Controls应该是所有win32环境都有的。