.NET › .NET CLI, SDK & Project Structure (csproj)
What are MSBuild properties and items, and how do they control the build process?
AdvancedAnswer
MSBuild properties (in PropertyGroup, e.g., <TargetFramework>, <Nullable>, <LangVersion>) are single named values controlling build behavior, while items (in ItemGroup, e.g., <PackageReference>, <Compile>, <ProjectReference>) represent lists of inputs like source files, package dependencies, or project references. MSBuild evaluates these to construct and execute the actual build graph (compilation, resource embedding, packaging).
<PropertyGroup>
<OutputType>Exe</OutputType>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Legacy/**/*.cs" />
<ProjectReference Include="..\MyLib\MyLib.csproj" />
</ItemGroup>Real-world example A project excludes an obsolete Legacy folder from compilation using a Compile Remove item, keeping the dead code in source control for reference without it being built.