C# vshost.exe 文件的用途是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/774187/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the purpose of the vshost.exe file?
提问by Milen
When I create and compile a "Hello, World!" application in C#, I get three files in the Debug folder apart from the main exe (e.g. HelloWorld.exe)
当我创建和编译一个“Hello, World!” 在 C# 中的应用程序,除了主 exe(例如 HelloWorld.exe),我在 Debug 文件夹中得到三个文件
- HelloWorld.vshost.exe
- HelloWorld.pdb
- HelloWorld.vshost.exe.manifest
- HelloWorld.vshost.exe
- 你好世界.pdb
- HelloWorld.vshost.exe.manifest
What purpose do these files serve?
这些文件有什么用途?
采纳答案by Jon Skeet
The vshost.exe feature was introduced with Visual Studio 2005 (to answer your comment).
vshost.exe 功能是在 Visual Studio 2005 中引入的(为了回答您的评论)。
The purpose of it is mostly to make debugging launch quicker - basically there's already a process with the framework running, just ready to load your application as soon as you want it to.
它的目的主要是让调试启动更快——基本上已经有一个运行框架的进程,只要你愿意就可以加载你的应用程序。
See this MSDN articleand this blog postfor more information.
回答by Will Eddins
The vshost.exe file is the executable run by Visual Studio (Visual Studio host executable). This is the executable that links to Visual Studio and improves debugging.
vshost.exe 文件是由 Visual Studio 运行的可执行文件(Visual Studio 主机可执行文件)。这是链接到 Visual Studio 并改进调试的可执行文件。
When you're distributing your application to others, you do not use the vshost.exe or .pdb (debug database) files.
将应用程序分发给其他人时,不要使用 vshost.exe 或 .pdb(调试数据库)文件。
回答by Daniel Brückner
.exe - the 'normal' executable
.vshost.exe - a special version of the executable to aid debuging; see MSDNfor details
.pdb - the Program Data Basewith debug symbols
.vshost.exe.manifest - a kind of configuration filecontaining mostly dependencies on libraries
回答by Brian Rasmussen
I'm not sure, but I believe it is a debugging optimization. However, I usually turn it off (see Debug properties for the project) and I don't notice any slowdown and I see no limitations when it comes to debugging.
我不确定,但我相信这是一种调试优化。但是,我通常将其关闭(请参阅项目的调试属性)并且我没有注意到任何减速,并且在调试方面没有任何限制。
回答by Joshua
It seems to be a long-running framework process for debugging (to decrease load times?). I discovered that when you start your application twice from the debugger often the same vshost.exe process will be used. It just unloads all user-loaded DLLs first. This does odd things if you are fooling around with API hooks from managed processes.
这似乎是一个长时间运行的调试框架过程(以减少加载时间?)。我发现当您从调试器启动应用程序两次时,通常会使用相同的 vshost.exe 进程。它只是首先卸载所有用户加载的 DLL。如果您正在使用来自托管进程的 API 钩子,这会做一些奇怪的事情。
回答by SimplyInk
Adding on, you can turn off the creation of vshost files for your Releasebuild configuration and have it enabled for Debug.
另外,您可以关闭为发布构建配置创建 vshost 文件,并为Debug启用它。
Steps
脚步
- Project Properties> Debug> Configuration (Release) > Disable the Visual Studio hosting process
- Project Properties> Debug> Configuration (Debug) > Enable the Visual Studio hosting process
- 项目属性>调试> 配置(发布)> 禁用 Visual Studio 托管进程
- 项目属性>调试> 配置(调试) > 启用 Visual Studio 托管进程
Reference
参考
Excerpt from MSDN How to: Disable the Hosting Process
Calls to certain APIs can be affected when the hosting process is enabled. In these cases, it is necessary to disable the hosting process to return the correct results.
启用托管进程时,对某些 API 的调用可能会受到影响。在这些情况下,有必要禁用托管进程以返回正确的结果。
To disable the hosting process
禁用托管进程
- Open an executable project in Visual Studio. Projects that do not produce executables (for example, class library or service projects) do not have this option.
- On the Projectmenu, click Properties.
- Click the Debugtab.
- Clear the Enable the Visual Studio hosting processcheck box.
- 在 Visual Studio 中打开一个可执行项目。不生成可执行文件的项目(例如,类库或服务项目)没有此选项。
- 在项目菜单上,单击属性。
- 单击调试选项卡。
- 清除启用 Visual Studio 托管进程复选框。
When the hosting process is disabled, several debugging features are unavailable or experience decreased performance. For more information, see Debugging and the Hosting Process.
当托管进程被禁用时,一些调试功能不可用或性能下降。有关更多信息,请参阅调试和托管过程。
In general, when the hosting process is disabled:
- The time needed to begin debugging .NET Framework applications increases.
- Design-time expression evaluation is unavailable.
- Partial trust debugging is unavailable.
一般来说,当托管进程被禁用时:
- 开始调试 .NET Framework 应用程序所需的时间会增加。
- 设计时表达式计算不可用。
- 部分信任调试不可用。