The Order Book's project is break point B1: a project file in the classic format, in which every source file is listed individually, plus
a packages.config and an AssemblyInfo.cs. .NET 10 does not understand this format. Before the program can target the new runtime,
it has to change the format.
Microsoft's documentation advises doing this in two separate steps: First you convert the project to the SDK format while it still targets .NET Framework. Only then do you change the target. The reason is simple: If something breaks after the first step, it is the format's fault and not the runtime's. Thanks to the tests from lesson M2.1, you see that immediately.
The old and the new format
| Classic format | SDK format | |
|---|---|---|
| Head | ToolsVersion, two Import lines, project GUID |
<Project Sdk="Microsoft.NET.Sdk"> |
| Source files | every Compile line individually |
all .cs files under the project folder, without an entry |
| Packages | packages.config, folder packages, HintPath |
PackageReference in the project file |
| Assembly information | Properties/AssemblyInfo.cs |
properties of the project file, generated by the SDK |
| Target framework | TargetFrameworkVersion v4.8 |
TargetFramework net48, also several: TargetFrameworks |
| Configurations | two PropertyGroup elements for Debug and Release |
the SDK's defaults |
The SDK format is shorter, knows several targets in one file and is required for .NET. And it includes all .cs files below
the project folder by itself. That is convenient but has a consequence: A file that you forgot to delete gets compiled along.