问题
我在 Windows XP Professional Version 2002 Service Pack 3 上使用 Microsoft Visual Studio 2005 Verison 8.0.50727.762 (SP.050727-7600) 编写了一个名为Foo"的 C++ 项目.我将该项目构建到 Foo.exe 中.然后,我将文件 Foo.exe 复制到 Windows Server 2003 Enterprise Edition Service Pack 2.当我尝试运行它时,它失败并出现此错误,
I wrote a C++ project called 'Foo' using Microsoft Visual Studio 2005 Verison 8.0.50727.762 (SP.050727-7600) on Windows XP Professional Version 2002 Service Pack 3. I built the project into Foo.exe. Then, I copied the file Foo.exe to a Windows Server 2003 Enterprise Edition Service Pack 2. When I tried to run it, it failed with this error,
C:foo.exe
The application has failed to start because the application configuration is incorrect.
Reinstalling the application may fix the problem.
在事件查看器 > 系统中,记录了三个事件.
In Event Viewer > System, three events were logged.
事件 ID:32;来源:SideBySide
Event ID: 32; Source: SideBySide
Dependent Assembly Microsoft.VC80.CRT could not be found and Last Error was
The referenced assembly is not installed on your system.
事件 ID:59;来源:SideBySide
Event ID: 59; Source: SideBySide
Resolve Partial Assembly failed for Microsoft.VC80.CRT.
Reference error message: The referenced assembly is not installed on your system.
事件 ID:59;来源:SideBySide
Event ID: 59; Source: SideBySide
Generate Activation Context failed for C:fooFoo.exe.
Reference error message: The referenced assembly is not installed on your system.
安装 Microsoft Visual C++ 2005 Redistributable 并没有修复它
C:windowswinsxsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd
的文件夹.C:windowswinsxsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd
.从添加或删除程序"中找到的该软件版本为8.0.50727.42".
The version of this software as found from 'Add or Remove Programs' was '8.0.50727.42'.
在尝试运行 C:foofoo.exe 时,我遇到了与上述相同的错误.
On trying to run C:foofoo.exe, I got the same errors I described above.
安装 Microsoft Visual C++ 2005 SP1 Redistributable 并没有修复它
C:windowswinsxsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700
.从添加或删除程序"中找到的该软件版本为8.0.56336".
The version of this software as found from 'Add or Remove Programs' was '8.0.56336'.
在尝试运行 C:foofoo.exe 时,我遇到了与上述相同的错误.
On trying to run C:foofoo.exe, I got the same errors I described above.
从同一台机器(我正在运行 EXE)复制 CRT DLL 和清单并没有解决问题.
msvcm80.dll
、msvcp80.dll
和 msvcr80.dll
C:WINDOWSWinSxSx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd
C:foo
.C:WINDOWSWinSxSManifestsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd.manifest
到 C:foo
并将其重命名为 Microsoft.VC80.CRT.manifest
.msvcm80.dll
, msvcp80.dll
and msvcr80.dll
from
C:WINDOWSWinSxSx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd
to C:foo
.C:WINDOWSWinSxSManifestsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd.manifest
to C:foo
and renamed it to Microsoft.VC80.CRT.manifest
.清单文件的第四行如下所示:
The fourth line of the manifest file looked like this:
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.42"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
当我这次尝试运行 C:foofoo.exe 时,它不起作用.我用 C:windowswinsxsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700
中的 DLL 和相应的清单文件再次重复了这件事.它也没有帮助.我遇到了同样的错误.
When I tried running C:foofoo.exe this time, it didn't work. I repeated this thing again with the DLLs in C:windowswinsxsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700
and the corresponding manifest file. It didn't help as well. I got the same error.
在这两种情况下,我都在事件查看器 > 系统中遇到以下错误.
In both cases, I got the following errors in Event Viewer > System.
事件 ID:34;来源:SideBySide
Event ID: 34; Source: SideBySide
Component identity found in manifest does not match the identity of the component requested
事件 ID:58;来源:SideBySide
Event ID: 58; Source: SideBySide
Syntax error in manifest or policy file "C:fooMicrosoft.VC80.CRT.MANIFEST" on line 4.
事件 ID:59;来源:SideBySide
Event ID: 59; Source: SideBySide
Generate Activation Context failed for C:fooFoo.exe. Reference error message: The manifest file contains one or more syntax errors.
从 Windows XP 机器(我在其中构建 EXE)复制 CRT DLL 和清单并没有解决问题.
msvcm80.dll
、msvcp80.dll
和 msvcr80.dll
C:winntwinsxsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700
Windows XP 机器(我在那里开发和构建了 foo.exe)到 Windows Server 2003 的 C:foo
(我正在尝试运行 foo.exe).C:winntwinsxsManifestsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700.manifest
到 C:foo
并将其重命名为 Microsoft.VC80.CRT.manifest
.msvcm80.dll
, msvcp80.dll
and msvcr80.dll
from
C:winntwinsxsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700
of Windows XP machine (where I developed and built foo.exe)
to C:foo
of Windows Server 2003 (where I am trying to run foo.exe).C:winntwinsxsManifestsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700.manifest
to C:foo
and renamed it to Microsoft.VC80.CRT.manifest
.清单文件的第四行如下所示:
The fourth line of the manifest file looked like this:
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
在尝试运行 C:foofoo.exe 时,我遇到了上一节中提到的相同错误.
On trying to run C:foofoo.exe now I got the same errors mentioned in the previous section.
从 Visual Studio 文件夹复制 CRT DLL 和清单修复了它.
msvcm80.dll
、msvcp80.dll
、msvcr80.dll
和Microsoft.VC80.CRT.manifest
> 从 Windows XP 机器的 C:Program FilesMicrosoft Visual Studio 8VC
edistx86Microsoft.VC80.CRT
到 C:foo
的 Windows Server 2003 机器(我正在尝试运行它).msvcm80.dll
, msvcp80.dll
, msvcr80.dll
and Microsoft.VC80.CRT.manifest
from C:Program FilesMicrosoft Visual Studio 8VC
edistx86Microsoft.VC80.CRT
of Windows XP machine (where I developed and built foo.exe) to C:foo
of Windows Server 2003 machine (where I am trying to run it).清单文件的第四行如下所示:
The fourth line of the manifest file looked like this:
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.6195"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
这次我可以毫无问题地运行 C:foofoo.exe.
This time I could run C:foofoo.exe without any issues.
问题
我希望按照第二种方法的描述安装Microsoft Visual C++ 2005 SP1 Redistributable"(vcredist_x86.exe) 会修复它.但它没有.从开发机器的 C:Program FilesMicrosoft Visual Studio 8VC
edistx86Microsoft.VC80.CRT
文件夹复制 DLL 和清单文件修复了它.为什么会这样?
I was expecting that installing 'Microsoft Visual C++ 2005 SP1 Redistributable' (vcredist_x86.exe) as described in the second approach would fix it. But it didn't. Copying the DLLs and manifest files from the C:Program FilesMicrosoft Visual Studio 8VC
edistx86Microsoft.VC80.CRT
folder of the development machine fixed it. Why was it so?
构建选项
以防万一,它可以帮助您回答我的问题.这是我从 Visual Studio 项目属性中选取的编译器和链接器选项:
In case, it helps you to answer my question. Here is the compiler and linker options I picked up from Visual Studio project properties:
配置属性 > C/C++ > 命令行:
Configuration properties > C/C++ > Command Line:
/O2/GL/D "_MBCS"/FD/EHsc/MD/Fo"Release\"/Fd"Releasevc80.pdb"/W3/nologo/c/Wp64/Zi/TP/错误报告:提示
配置属性>链接器>命令行:
Configuration properties > Linker > Command Line:
/OUT:"C:MixedBagReleaseFoo.exe"/NOLOGO/MANIFEST/MANIFESTFILE:"ReleaseFoo.exe.intermediate.manifest"/DEBUG/PDB:"c:MixedBag
eleaseFoo.pdb"/OPT:REF/OPT:ICF/LTCG/MACHINE:X86/ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
我会回答我自己的问题.Hans Passant 和 Luke 对问题的评论有所帮助.
I'll answer my own question. Comments to the question by Hans Passant and Luke helped.
我下载了 Microsoft Visual C++ 2005 Service Pack 1 Redistributable打包 MFC 安全更新 并将其安装在我试图运行 C:foofoo.exe
的系统上.此后 EXE 运行良好.
I downloaded Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update and installed it on the system where I was trying to run C:foofoo.exe
. The EXE ran fine after this.
安装程序将 CRT DLL 放置在 C:windowswinsxsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86
.所以,是的,正如 Hans Passant 所说,8.0.50727.6195 是我正在寻找的 CRT DLL 版本.
The installer placed the CRT DLLs in C:windowswinsxsx86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.6195_x-ww_44262b86
. So, yes, 8.0.50727.6195 was the version of the CRT DLLs I was looking for as Hans Passant rightly said.
确定此版本的最简单方法是在开发系统上构建我的项目时查看 Visual Studio 生成的清单文件.我的位于 C:FooReleaseFoo.exe.intermediate.manifest
.它有一个这样的标签:
The easiest way to figure this version was by looking at the manifest file generated by Visual Studio while building my project on the development system. Mine was located at C:FooReleaseFoo.exe.intermediate.manifest
. It had a tag like this:
<assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.6195'
processorArchitecture='x86'
publicKeyToken='1fc8b3b9a1e18e3b' />
所以,这是我需要 8.0.50727.6195 版本的 DLL 的线索.剩下的就是搜索正确的 vcredist_x86.exe,它恰好在我在第二段中提到的 URL 中.该 URL 中的页面包含指向 KB2538242 的链接,该链接显示了将要使用的 DLL 的版本号由安装程序安装.
So, this is a clue that I needed 8.0.50727.6195 version of the DLLs. The rest was a matter of searching for the right vcredist_x86.exe which happened to be in the URL I have mentioned in the second paragraph. The page in that URL contains a link to KB2538242 which shows the version numbers of the DLLs that would be installed by the installer.
注意:正如 Elie 在这个问题的不同的答案中提到的,因为这是一个 32 位应用程序,无论该系统是 32 位 Windows 系统还是 64 位 Windows 系统,都需要在应该运行此应用程序的系统上安装 vcredist_x86.exe(不是 vcredist_x64.exe)..manifest 文件再次在 processorArchitecture
属性中提供了这个线索.
Note: As Elie has mentioned in a different answer to this question, since this is a 32-bit application, it is necessary to install vcredist_x86.exe (not vcredist_x64.exe) on the system where this application is supposed to be run irrespective of whether that system is a 32-bit Windows system or a 64-bit Windows system. Once again, the .manifest file provides this clue in the processorArchitecture
attribute.
这篇关于当我在一台机器上开发一个 EXE 并在另一台机器上运行它时,为什么安装 vcredist_x86.exe 不能修复 SideBySide 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!