36

I found the following information about the Microsoft Visual Studio "extra" files:

What is the purpose of the vshost.exe file?

My question is, is there a way that I can NOT have the .pdb, .manifest and vshost.exe files from being made? Or are they absolutely necessary?

I just noticed that after debugging it, it's still showing up as a running process in my machine which worries me since I already closed it.

2
  • 1
    It seems to me that you did not really understand what he says in his post. .vshost is needed to start quickly your debug session. Nothing to worry about.
    – Steve
    Commented Mar 1, 2012 at 10:24
  • but i also found the vshost.exe running double
    – gumuruh
    Commented Apr 3, 2014 at 6:42

2 Answers 2

64

Switch to the Release configuration. Then Project + Properties, Debug tab, untick the "Enable the Visual Studio hosting process" option. Build + Clean, you can delete anything that's left and it won't come back. That this option is turned on by default for the Release build is, arguably, a bit of a flaw but defensible.

The hosting process is a custom hosted version of the CLR. Exactly what it does is not well documented but it is related to configuring the security settings of the primary AppDomain. I've never heard anybody complain about battling CAS problems without it, but then it is unusual to turn it off and your app almost always runs in full trust when debugging from the IDE. It would matter if you build to a network share on early versions of .NET. The only thing that's obvious from disabling it is that anything you write with Console.Write in a gui style app will no longer appear in the Output window. It has nothing to do with speed as claimed in the highly upvoted answer in the link, the core framework DLLs are already resident in RAM since VS and MSBuild uses them.

Best thing to do is just not worry about it too much. A Setup and Deployment project will ignore it.

3
  • 1
    It'd be nice to disable it from builds for 'content-only projects'. Commented Apr 19, 2013 at 20:33
  • Thank you. I had a project upgraded from VS2008 -> VS2013 that refused to read the app.config file. Then I learned that it was searching for XXX.vshost.exe.config which was not being generated via AppDomain.CurrentDomain.SetupInformation.ConfigurationFile. So I turned it off like above. Then I had to rename my app.config file to {projectName}.config, put it in the bin folder and it finally worked.
    – drzounds
    Commented Jun 29, 2016 at 19:46
  • It looks like the "Enable the Visual Studio hosting process" option is no longer present in VS2017 and it appears that the project runs as the defined exe, rather than the vshost.exe. Perhaps vshost is a thing of the past as of VS2017?
    – HotN
    Commented Jun 15, 2017 at 16:32
1

Regarding vshost files, at least in VS2010:

  • They are not generated on build, but on selection of build configuration (it will be generated in release when we select release for the first time) and on setting "Enable the Visual Studio hosting process" to true. (As configuration debug and this option set to true are defaults, vshost.exe will be created in bin/debug on opening VS with target project by default.)
  • They are not cleaned on rebuilding or cleaning the project, but only manually when "Enable the Visual Studio hosting process" is false if VS with that project is open. (And it won't be generated anymore when opening this project.)

If this flag option is true and VS with target project is opened, this file cannot be deleted as being used. Once when it is unchecked, vshost.exe can be immediately deleted.

Summary: Generating and removing these files is not related to build process.

Also, I may add that option "Enable the Visual Studio hosting process" in referenced projects which are class libraries is not considered. This option is only considered for target project which generates executable file.

Not the answer you're looking for? Browse other questions tagged or ask your own question.