Compatibility and migrating minimal APIs to .NET 9
Let’s assume that you have already created a minimal API project, but the .NET version is not the latest. You wish to deploy the API, but before you do so, you intend to bring the code base to the latest .NET version, which at the time of writing this book is 9. What factors do we need to consider to be confident that our application will run efficiently on this new version, and how can we migrate to it?
Before any .NET migration, it is critical that you consult Microsoft’s documentation, where any known breaking changes are outlined.
.NET breaking changes fall into three categories:
- Binary incompatible: Existing binaries may fail to load and may need to be recompiled.
- Source incompatible: Code may require change in order to compile.
- Behavioral change: Code and binaries may behave differently after update, meaning code changes would be required.
While Microsoft is usually pretty effective...