Project File .csproj


Each C# project has a file that is responsible for the overall configuration of the project. By default, this file is called NameProject.csproj.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>

    <OutputType>Exe</OutputType>

    <TargetFramework>net6.0</TargetFramework>

    <ImplicitUsings>enable</ImplicitUsings>

    <Nullable>enable</Nullable>

  </PropertyGroup>

</Project>

This file in the form of xml code defines the configuration of the project and it can contain many elements. I will focus only on two main ones:

  • OutputType: Defines the output type of the project. This can be an executable application in the form of an exe file that is launched when clicked. And it can also be a file with the .dll extension - some set of functionality that is used by other projects. By default, the value "Exe" is set here, which means that we are creating an executable application.

  • TargetFramework: defines the version of the .NET framework used for compilation. In this case, this value is "net6.0", that is, it is applied.NET 6.0.

At the earliest stages, this file may not be needed, but later it may be necessary to make some configuration changes, and then there may be a need to access this file.

 

Source: https://metanit.com/sharp/tutorial/1.5.php