什么是 Windows 命令行 EXE 的“并行配置”?我该如何纠正它?
我有一个用 C++ 编写的简单 .exe(使用 Visual Studio 2005 构建),它使用提供的 API 测试一些硬件。它在我构建它的 Windows 7 计算机上运行良好,但是当我将其复制到另一台 (Windows 7) 计算机并运行它(从命令行)时,我得到:
应用程序启动失败 因为它的并排配置 是不正确的。请参阅 应用程序事件日志或使用 命令行 sxstrace.exe 工具 更多细节。
什么是“并行配置”?
我运行 sxstrace.exe 并阅读使用信息。看来我需要检测我的 exe 来生成日志文件,以便 sxstrace.exe 有用吗?
我想问题是我的 exe 需要的 DLL 要么在其他机器上不存在,要么是错误的版本。如何找出我的 exe 使用哪些 DLL,以及它链接到我的计算机(运行的地方)上的哪些版本?关于将其复制到另一台计算机并使其运行还有其他建议吗?更多信息会有帮助吗?
I have a simple .exe written in C++ (built with Visual Studio 2005) that tests some hardware using a supplied API. It works fine on the Windows 7 machine I built it on, but when I copy it to another (Windows 7) machine and run it (from the command-line) I get:
The application has failed to start
because its side-by-side configuration
is incorrect. Please see the
application event log or use the
command-line sxstrace.exe tool for
more detail.
What is "side-by-side configuration"?
I ran sxstrace.exe and read the usage info. It appears I would need to instrument my exe to generate a log file for sxstrace.exe to be useful?
I imagine the problem is my exe requires DLLs that either don't exist on the other machine, or are the wrong version. How do I find out what DLLs my exe uses, and what versions it links to on my machine (where it works)? Any other advice on copying it to another machine and getting it running? Would more information help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
mfawzymkh 的 回答“应用程序无法启动,因为并排配置不正确”问题(链接到在他对此问题的回答中链接到的问题spirulence)似乎也适用于这个问题。 mfawzymkh 写道:
mfawzymkh 对同一答案的评论解释了如何构建为静态链接:
我这样做了,并排配置消息消失了。 (在为我正在使用的 DLL 安装其他内容后,我的 EXE 就可以工作了。)
mfawzymkh's answer to the "application has failed to start because the side by side configauration is incorrect" question (linked to in the question spirulence linked to in his answer to this question) appears to apply to this question also. mfawzymkh writes:
And mfawzymkh's comment on that same answer explains how to build as statically linked:
I did that and the side-by-side configuration message is gone. (And after installing something else for the DLL I was using, my EXE works.)
无论如何,我遇到了同样的问题。在事件查看器中,我收到一条错误消息:
“C:\\MyExe.exe”的激活上下文生成失败。清单或策略文件“C:\\MyExe.exe.Config”第 12 行出现错误。无效的 Xml句法。
果然,我更改了连接字符串并省略了结束引号。添加回来并解决了问题。
For what it's worth, I encountered the same issue. In the Event Viewer I had an error message that read:
Activation context generation failed for "C:\\MyExe.exe".Error in manifest or policy file "C:\\MyExe.exe.Config" on line 12. Invalid Xml syntax.
Sure enough, I'd changed a connection string and left out the closing quote. Added that back in and it solved the issue.
“当你在 VS 中构建它时,转到项目 -> 设置 -> C/C++ -> 代码生成并选择运行时库选项为 /MTd 而不是 /MDd”对我有用,尽管我对发布版本而不是调试版本。
微软 说:
/MT 使您的应用程序使用运行时库的多线程静态版本。定义 _MT 并导致编译器将库名称 LIBCMT.lib 放入 .obj 文件中,以便链接器将使用 LIBCMT.lib 来解析外部符号。
/MD
使您的应用程序使用运行时库的多线程和 DLL 特定版本。定义 _MT 和 _DLL 并使编译器将库名称 MSVCRT.lib 放入 .obj 文件中。
使用此选项编译的应用程序静态链接到 MSVCRT.lib。该库提供了一层代码,允许链接器解析外部引用。实际工作代码包含在 MSVCR100.DLL 中,与 MSVCRT.lib 链接的应用程序必须在运行时可用。
"when you build it in VS, go to projects->settings->C/C++->Code Generation and choose Runtime Lib options to be /MTd instead of /MDd" worked for me, although I was interested in the Release version instead of the Debug version.
Microsofto says:
/MT Causes your application to use the multithread, static version of the run-time library. Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib to resolve external symbols.
/MD
Causes your application to use the multithread- and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file.
Applications compiled with this option are statically linked to MSVCRT.lib. This library provides a layer of code that allows the linker to resolve external references. The actual working code is contained in MSVCR100.DLL, which must be available at run time to applications linked with MSVCRT.lib.
你是否也和这位朋友面临着同样的问题呢? 并排程序集、Windows 7 和 Visual工作室2005
Are you suffering from the same issue as this guy? Side-by-side assemblies, Windows 7, and Visual Studio 2005