I wrote a small C # application in Visual Studio 2012. In the Debug (and Release) folder, in addition to the Exe file to run the application, and the accompanying files and folders that I created (the Log folder, Settings folder) for the application to work, there are other files ( .config, vshost.exe.config, etc.).

Question: what are these files for? If you delete them, will the application be launched by clicking on the exe-file, and will it work correctly? the contents of the debug folder

  • If you want to give your program to other people, then, of course, in this form should not be done. You need to use special tools to create an installation package. For example, right click on the project name -> Publish (I don’t know how this command will be in the Russian version of VS) and the utility will be invoked to create an installation package based on your project. - Bulson

1 answer 1

  1. Files *.vshost.* for Visual Studio. They are loaded by the C # debugger (and probably VB) and are constantly in memory, and when you start the process for debugging, it is loaded in the context of the vshost process. This accelerates the start of debugging, and in the context of this process, calculations are performed in the Immediate Window. These files must be in the same directory as the application, because otherwise there will be problems with loading the dependent modules, and a request for the program directory will give an incorrect result. (A little more about vshost here .)
  2. The *.pdb files contain simple debugging information, such as local variable names and line numbers. They are needed so that the debugger can match the compiled code to the source text.
  3. *.manifest files are an assembly manifest . It can be included in the .exe or lie next to the file. For an .exe file, the manifest is included in it when compiling so as not to create unnecessary files. But for a .vshost file, it lies nearby, so that you do not need to recompile .vshost , that is, for optimization.
  4. The *.config files are the contents of your app's App.config . It stores application level settings. When installing the application, this file must be copied to the installation directory (in Program Files). User settings are stored in %APPDATA% current user and are created automatically.

These files do not need to be deleted, but if you delete, they will still be recreated by the compiler. For deployment, you only need .exe (and / or .dll ), and .config (one that is not from vshost). You can still save for yourself .pdb for future debugging, but customers do not need to include it in the delivery. (If you are compiling a version for debugging, then it will be useful.)

  • hmm ... but in more detail about * .vshost possible? Namely, why will the application directory be incorrectly defined, how is it related? Obviously for release build, with debug it is clear that everything is needed - rdorn
  • @rdorn: Well, many applications search for resources in the directory where the main assembly lies. If .vshost lies elsewhere, then Path.GetDirectory(Assembly.GetEntryAssembly().Location) will give the directory that contains .vshost , and not the compiled program. And this is a popular pattern. - VladD
  • And if I do not build from the studio, but by manual compilation for example? Once upon a time I dabbled in such a way to break an assembly into modules and update classes independently without having to reassemble everything, and it seemed to work without problems even without these files - rdorn
  • @rdorn: Of course, then they are not needed. These files are only for the Visual Studio debugger. - VladD
  • one
    @VladD, your answer does not have enough information about whether the application will work if you delete these files. - 4per