Search code examples
.netvisual-studioprojects

Do .NET projects in Visual Studio always compile into a single file?


This is one of those things that is so simple that no one ever just comes out and says it in any of the tutorials I've read.

I've been creating a few stand alone .NET applications as well as a few DLL based plug-ins for other programs. I've noticed that a project in Visual Studio, at least with Windows applications and class libraries, compile into a single file (EXE or DLL).

Is this always the case? In terms of organizing a larger application should I always think of projects in Visual Studio as corresponding to a single file in the final program?


Solution

  • Each project does compile to a single file. (Except for web site projects)

    However, if you set the Build Action for any file in the project to Copy Always or Copy if Newer, the project will copy that file to the output folder.
    Also, if an EXE project has an App.config file, it will also be copied to the output folder.

    If your project references a DLL (whether your own or someone else's) that isn't part of the core framework, it will copy that DLL to the project's output folder, resulting in two files (although only one of them will contain the code from the project itself)

    Also, in addition to DLLs and EXEs, Visual Studio will also create a .pdb file containing debug symbols in the output folder. This file is used by the debugger and must not be distributed to your users. (Unless you want them to debug your code for you)