Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 475
Eric Anastas Avatar asked Dec 10 '09 03:12

Eric Anastas


People also ask

How do you compile a project in VS?

In Solution Explorer, choose or open the solution. On the menu bar, choose Build, and then choose one of the following commands: Choose Build or Build Solution, or press Ctrl+Shift+B, to compile only those project files and components that have changed since the most recent build.

What are Visual Studio project files?

Project file The file extension reflects the type of project, for example, a C# project (. csproj), a Visual Basic project (. vbproj), or a database project (. dbproj). The project file is an XML document that contains all the information and instructions that MSBuild needs to build your project.

Do ASPX files need to be compiled?

In order for the ASP.NET engine to service a request for this page, the page's code portion (the WebPage. aspx. cs file) must first be compiled. This compilation can happen explicitly or automatically.


1 Answers

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)

like image 87
SLaks Avatar answered Oct 09 '22 02:10

SLaks