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)
What purpose do these files serve?
This question is related to
c#
visual-studio
debugging
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.
.exe - the 'normal' executable
.vshost.exe - a special version of the executable to aid debuging; see MSDN for details
.pdb - the Program Data Base with debug symbols
.vshost.exe.manifest - a kind of configuration file containing mostly dependencies on libraries
Adding on, you can turn off the creation of vshost files for your Release build configuration and have it enabled for Debug.
Steps
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.
To disable the hosting process
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.
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.
When you're distributing your application to others, you do not use the vshost.exe or .pdb (debug database) files.
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.
Source: Stackoverflow.com