Disabling the *.vshost.exe and miscellaneous files from being created on build

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.

Leave a Comment