[Record] host process [* .vshost.exe] & [* .vshost.exe. config]

Source: Internet
Author: User

I feel that many questions have been answered in depth in msdn. Unfortunately, I didn't learn to watch the dishes ..

Blog Source:

Http://www.cnblogs.com/know-life-death/archive/2011/07/04/2097841.html


Cause:

When you compile and release a WPF project in release mode, the [* .vshost.exe] & [* .vshost.exe. config] file is generated. Do [* .vshost.exe. config] and [*. EXE. config] need to be modified temporarily when you need to manually modify some configuration information in [*. config? Can I delete [* .vshost.exe] & [* .vshost.exe. config?

Host process [* .vshost.exe] & [* .vshost.exe. config]

[* .Vshost.exe] is also called a host process. It is a function in vs2005/2008/2010 that can improve debugging performance, support partial trust debugging, and support expression computing during design. The host process file name contains vshost, which is located in the output folder of the project.

The hosted program is started through [* .vshost.exe], and [* .vshost.exe] is a fixed program, vs will copy [* .vshost.exe] to the same directory of the debugged process, and then start [* .vshost.exe] in the background to save debugging time, until you close vs or close the current vs solution (. SLN file), Vs will terminate [* .vshost.exe].

[* .Vshost.exe] is responsible for creating application domains and associating the debugger with itself, because when you debug your.. Net project, [* .vshost.exe] is started only once, so every debugging is avoided. the process of preparing the debugging environment for the executable file. Then, [* .vshost.exe] uses appdomain. executeassembly function to execute our executable files.

The host process file (.vshost.exe) is used by Vs and should not be directly run or deployed through applications.

Improve debugging Performance

The host process creates an application domain and associates the debugger with the application. Executing these tasks causes a significant delay between the start of debugging and the start of running the application. By creating application domains and associated debuggers in the background, and saving the application domains and debugger statuses between running applications, the host process improves performance.

Partial trust debugging

On the project designer Security page, you can specify an application as a partially trusted application. Some trusted applications require special initialization of application domains. This Initialization is handled by the host process.

Expression computing during design

Design-time expression computation allows you to perform Code tests in the "real-time" window without running applications. The host process executes this code during expression computation at design time.

This will only affect the class library project. [* .vshost.exe] loads the. dll executable file into the application domain and interacts with Visual Studio to obtain the expression value. If [* .vshost.exe] is disabled, you cannot use the design-time expression to calculate this function in the Type Library Project. However, you can still use the design-time expression function of the executable file, Because visual studiodirectly starts your executable. EXE file.

Debugging and host Processes

The Visual Studio host process improves the performance of the debugger and enables New debugger features, such as partial trust debugging and expression computing during design. If necessary, you can disable the host process.

Differences between debugging with and without a host process

1) partially trusted debugging and click-once security

Some trust debugging requires the host process. If the host process is disabled, some trust debugging does not work, even if some trust security is enabled on the "Security" page of "Project Properties.

2) expression computing during design

During design, the expression always uses the host process. If the host process is disabled in "Project Properties", expression calculation is disabled during the design of the class library project. For other project types, expression calculation is not disabled during design. Instead, Visual Studio starts the actual executable file and uses it for design-time computing without the host process. This difference may produce different results.

3) Differences in appdomain. currentdomain. friendlyname

Appdomain. currentdomain. friendlyname returns different results based on whether the host process is enabled. If appdomain. currentdomain. friendlyname is called when the host process is enabled, app_name.vhost.exe is returned. If the host process is called when disabled, it returns app_name.exe.

4) Differences in assembly. getcallingassembly (). fullname

Assembly. getcallingassembly (). fullname returns different results based on whether the host process is enabled. If assembly. getcallingassembly (). fullname is called when the host process is enabled, mscorlib is returned. If assembly. getcallingassembly (). fullname is called when the host process is disabled, the application name is returned.

Disable host process

1) Project Properties

2) Remove the check box in the figure.

After the host process is disabled, the following situations occur:

1) the amount of time required to start debugging. NET Framework applications has increased.

2) expression computing is unavailable during design.

3) partially trusted debugging is unavailable

For details, refer:Detailed analysis process of vshost.exe debugging host process

Conclusion:

Based on the preceding information, the host process [* .vshost.exe] & [* .vshost.exe. config] is only used in the debugging or design phase. Compiling the WPF project in release generates [* .vshost.exe] & [* .vshost.exe. config] for debugging and other related actions. Theoretically, it can be deleted after release.

Test results:

Delete the host process-related files, [* .vshost.exe] & [* .vshost.exe. config]. Test the project function. No exception was found. It can be seen that the files [* .vshost.exe] & [* .vshost.exe. config] related to the host process can be deleted after the release, without affecting the program functions.

Test software environment:
Vs2010 + SQL server2005 + WPF

Reference List:
Http://blog.csdn.net/donjuan/article/details/3849508

Http://topic.csdn.net/u/20080512/10/a1af6fe8-ac18-414a-bee7-aa1b64c98006.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.