Guy
Guy

Reputation: 67290

What is the *.vshost.exe.config file?

When I compile an application with VS2008 I sometimes end up with 2 identical config files:

What is the latter one for?

Upvotes: 50

Views: 33750

Answers (4)

Humayoun_Kabir
Humayoun_Kabir

Reputation: 2251

This file's sole purpose is to help debugging and hosting Process.Visual Studio hosting process improves debugger performance. It enables new debugger features, such as partial-trust debugging and design-time expression evaluation.

If you disable the hosting process, partial-trust debugging will not work even if partial-trust security is enabled on the Security page of Project Properties.

You can disable that by Project menu -> click Properties -> Debug tab -> Clear the Enable the Visual Studio hosting process check box. Design-time expression always uses the hosting process. Disabling the hosting process in the Project Properties disables design-time expression evaluation for Class Library projects.

For other project types, design-time expression evaluation is not disabled. Instead, Visual Studio starts the actual executable and uses it for design-time evaluation without the hosting process.

Upvotes: 2

robvon
robvon

Reputation: 21

I noticed something else about this behaviour.

Whilst VS WILL create a config called [appname].vshost.exe.config, the API call:

var s = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile

does not return this name, rather it returns: [appname].config

This was using VS2010. Not checked in VS2008

Upvotes: 2

Brian
Brian

Reputation: 118865

Here's a blog post that talks about the vshost process and its purpose.

http://blogs.msdn.com/dtemp/archive/2004/08/17/215764.aspx

Upvotes: 28

Winston Smith
Winston Smith

Reputation: 21882

When debugging inside VS your application will be called [appname].vshost.exe and so the .vshost.exe.config file is where the .net runtime will look for the program's config.

Upvotes: 17

Related Questions