How to install missing frame work

MUKISA JOHNMARY 0 Reputation points
2025-02-04T12:13:29.7866667+00:00

In the module name Create a web UI with ASP.NET Core all instructions say that the framework in use is .NET 8 however the project provided for the case study uses .NET 7 how can i change this project to use .NET 8. currecntly running the command dotnet watch leads to the following error.

User's image

User's image

This question is related to the following Learning Module

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
2,018 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pradeep M 5,435 Reputation points Microsoft Vendor
    2025-02-04T12:22:05.8333333+00:00

    Hi MUKISA JOHNMARY,

    Thank you for reaching out to Microsoft Q & A forum. 

    Here the project targeting .NET 7, but you’d like to use .NET 8 instead. In this case, you have two options: 

    1.Install .NET 7: If you prefer to keep the project as it is, you can install the .NET 7 SDK from the official Microsoft website: 

    Download .NET 7 SDK 

    2.Upgrade the project to .NET 8: If you'd rather use .NET 8, follow these steps: 

    1.Update the Target Framework: 

    Open the .csproj file (likely named ContosoPizza.csproj) and look for this line: 

    <TargetFramework>net7.0</TargetFramework>
    
    

    Change it to: 

    <TargetFramework>net8.0</TargetFramework>
    
    
    

    2.Update NuGet Packages: 

    If there are any NuGet packages targeting .NET 7, you might need to update them. You can do this through the Visual Studio NuGet Package Manager or by running: 

    dotnet add package <PackageName> --version <LatestCompatibleVersion>
    
    

    3.Clear and Restore Dependencies: 

    Run these commands to ensure everything’s fresh: 

    dotnet clean
    dotnet restore
     
    

    4.Run the Project: 

    Now try running the project again

    dotnet watch
    

    Please feel free to contact us if you have any additional questions.     

    If you have found the answer provided to be helpful, please click on the "Accept answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.  

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.