2023-09-05

Converting MSBuild project files from legacy-style to SDK-style

I recently did this at work, and I decided to document the process here in the form of a how-to guide.

Sdk-style project files have existed since net5. The kind of project files we were using before that can now be called legacy-style project files.

  • Legacy-style project files begin with <Project ToolsVersion="...
  • Sdk-style project files begin with <Project Sdk="Microsoft.NET.Sdk">.

Sdk-style project files still work with dotnet-framework projects, but they are necessary if you want to:

  • Start using the `dotnet` command-line utility and all the functionality that it provides.
  • Eventually migrate to a more recent version of dotnet.