c_sharp_compilation

C# Compiling - C Sharp Compilation

Compilation

“The C# compiler compiles source code (a set of files with the .cs extension) into an C# assembly. An assembly is the unit of packaging and deployment in .NET. An assembly can be either an application or a library. A normal console or Windows application has an entry point, whereas a library does not. The purpose of a library is to be called upon (referenced) by an application or by other libraries. .NET 5 itself is a set of libraries (as well as a runtime environment).” (Fair Use B08SYWWDTX)

“Each of the programs in the preceding section began directly with a series of C# statements (called top-level statements). The presence of top-level statements implicitly creates an entry point for a console or Windows application. (Without top-level statements, a C# Main method denotes an application’s entry point — see “ Custom Type Examples”.)” (Fair Use B08SYWWDTX)

“To invoke the compiler, you can either use an integrated development environment (IDE) such as Visual Studio or Visual Studio Code, or call it manually from the command line. To manually compile a console application with .NET, first download the .NET 5 SDK, and then create a new project, as follows:

dotnet new console -o MyFirstProgram cd MyFirstProgram

This creates a folder called MyFirstProgram, which contains a C# file called Program.cs, which you can then edit. To invoke the compiler, call dotnet build (or dotnet run, which will compile and then run the program). The output will be written to a subdirectory under bin\debug, which will include MyFirstProgram.dll (the output assembly) as well as MyFirstProgram.exe (which runs the compiled program directly).” (Fair Use B08SYWWDTX)

c_sharp_compilation.txt · Last modified: 2024/04/28 03:23 (external edit)