Issue upgrade from 3.1 to .net 6

Muhammad Shawkat Khan 0 Reputation points
2023-02-03T16:21:16.1+00:00

I'm trying to upgrade from 3.1 to .net 6 getting below error. I've installed SDK 6.0.405 but no luck.

Severity Code Description Project File Line Suppression State

Error MSB3971 The reference assemblies for ".NETFramework,Version=v6.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK. GBClaims.Lib.Framework.Utilities.Web C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.target

Can you please help me on it

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,375 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,001 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,271 Reputation points Microsoft Vendor
    2023-02-06T08:52:57.83+00:00

    Hi @Muhammad Shawkat Khan ,

    Welcome to Microsoft Q&A forum.

    Have you tried to add/set <TargetFramework>net6.0</TargetFramework> in your project(.xxproj file)? Please try to update Visual Studio to the latest version, if you are not using the latest version of VS 2022 Enterprise.

    Besides, will the .NET 6.0 be listed when you create a new project? Did you use any assembly which maybe depend on earlier version of .NET? If so please try to update the assembly. Please also try to clean your project cache(delete the hidden .vs folder) and rebuild your project(reinstall NuGet packages if possible).


    Update1:

    Please open VS Installer > Modify > switch to Individual components tab > .NET and make sure that .NET SDK and .NET 6.0 Runtime (Long Term Support) have been checked.

    Remove the hidden .vs, bin and obj folders in your solution/project folder and then rebuild you project and restart VS to check if the error disappears.

    Please try to repair Visual Studio from VS Installer > More > Repair and reset VS settings(run devenv /ResetSettings in Developer Command Prompt for Visual Studio 2022) if above methods don’t work.

    Feel free to contact us.

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Igo, Sean 0 Reputation points
    2023-07-12T16:20:20.67+00:00

    I had this issue and found that the global.json file at the project root had the older .NET sdk version. Changing that to the correct sdk version (found by running dotnet --list-sdks at a command line) fixed it.

    {
        "sdk": {
        "version": "6.0.315",
        "rollForward": "latestPatch"
        }
    }
    
    0 comments No comments