Migrating from .NET 7 to .NET 8

Teja Sai Srinivas Khajjayam
2 min readMay 24, 2024

--

Developer’s Guide

This guide provides a step-by-step roadmap for migrating your .NET 7 applications to .NET 8, covering key areas such as Visual Studio compatibility, SDK installation, Docker updates, and handling breaking changes. Follow these instructions to ensure a seamless transition and take advantage of the latest features and improvements in .NET 8.

Upgrade Steps

1)Update Visual Studio: Make sure you are using the latest version of Visual Studio to ensure compatibility with .NET 8.
2)Install .NET 8 SDK: Download and install the .NET 8 SDK to access the newest features and enhancements.
3)Install .NET Upgrade Assistant: Use the .NET Upgrade Assistant to identify and address potential issues during the migration process.
4)Upgrade Projects in Solution: Right-click on each project in your solution and select “Upgrade” to update project files, reference libraries, and related projects. More details on the Upgrade Assistant can be found here.

Docker Updates (if applicable)

Update Dockerfile for Web Projects: Change the FROM statement in each web project’s Dockerfile to use the ASP.NET Core 8.0 runtime:

Adjust Dockerfile Exposed Port: If necessary, change the exposed port in the Dockerfile from 80 to 8080. Update relevant configurations to match the new default ASP.NET Core port.
Update Docker-Compose Configuration: Modify the service mappings in the Docker-Compose configuration from port 80 to 8080 to align with the new default web services port.
Modify API Gateway Configuration (Ocelot.json): Update the Swagger API configuration’s “services port” in the Ocelot.json file to 8080 to ensure compatibility with the new default web services port. Be aware that other Swagger documentation may need adjustments.

Important Links

· Upgrade Assistant Overview

· Compatibility with .NET 8

· C# 12 Features

· What’s New in .NET 8

Deployment Considerations

Coordinate with your DevOps team during deployment to map hosted service ports to 8080 for proper functionality.

LINQ Pattern Identification

Post-migration, no syntactical or runtime errors were found in Entity Framework-related LINQ queries. Microsoft’s Breaking Changes Documentation did not report any LINQ-related breaking changes.

Findings

The default hosting port for ASP.NET Core has changed from 80 to 8080.

Host Changes

Ensure all hosting-related configurations are updated according to the changes in .NET 8.

View Detailed Information

For more comprehensive details, refer to the Breaking changes in .NET 8 document, which includes sections on ASP.NET Core and Entity Framework Core.

For more interesting content please like and follow

#Happy Coding

#Happy Learning

--

--

Teja Sai Srinivas Khajjayam

Hey, 👨🏻‍💻This is TJ, a passionate full-stack developer with a love for coding and love to extract the valuable insights from the data.