Migration net3 to version net 6

Emanuel Jiménez 20 Reputation points
2023-07-17T12:47:15.5866667+00:00

I have this error en proyect when pipeline try to run project test

  1. C:\hostedtoolcache\windows\dotnet\dotnet.exe test D:\a\1\s\AB2.Tests\AB2.Tests.csproj --logger trx --results-directory D:\a_temp

C:\hostedtoolcache\windows\dotnet\sdk\3.1.426\Microsoft.Common.CurrentVersion.targets(1177,5): 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. [D:\a\1\s\AB2.Tests\AB2.Tests.csproj]

##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1

C:\hostedtoolcache\windows\dotnet\dotnet.exe test D:\a\1\s\Common.Tests\Common.Tests.csproj --logger trx --results-directory D:\a_temp

C:\hostedtoolcache\windows\dotnet\sdk\3.1.426\Microsoft.Common.CurrentVersion.targets(1177,5): 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. [D:\a\1\s\Common.Tests\Common.Tests.csproj]

##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1

C:\hostedtoolcache\windows\dotnet\dotnet.exe test D:\a\1\s\ThirteenF.Tests\ThirteenF.Tests.csproj --logger trx --results-directory D:\a_temp

C:\hostedtoolcache\windows\dotnet\sdk\3.1.426\Microsoft.Common.CurrentVersion.targets(1177,5): 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. [D:\a\1\s\ThirteenF.Tests\ThirteenF.Tests.csproj]

##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1

##[warning]No test result files were found.

##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build

Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting

##[error]Dotnet command failed with non-zero exit code on the following projects : [

Ctrl + M

.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,097 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 27,465 Reputation points Microsoft Employee
    2023-07-18T04:45:07.0466667+00:00

    @Emanuel Jiménez Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    I see that you're encountering an error when running a pipeline to test a project. The error message indicates that the reference assemblies for ".NETFramework,Version=v6.0" were not found. This error suggests that you might be using an older .NET SDK to target .NET 5.0 or higher.

    To resolve the error, you can try the following troubleshooting steps:

    1. While migrating an app to .NET 6 there are some breaking changes. I would recommend you to go through the compatibility check.
    2. Could You please review the .NET 6 Compatibility Guide.
    3. Check the version of the .NET SDK that you're using. You can do this by running the following command in a command prompt or terminal window:
    dotnet --version
    

    This command will display the version of the .NET SDK that is currently installed on your system. If the version is older than 5.0, you should update it to the latest version.

    1. You also need to run the command dotnet –list-runtimes and check the installed dotnet runtimes.
    2. Update Visual Studio to the latest version. Visual Studio includes many tools and features that are designed to work with .NET 6.0.
      User's image
    3. Check the project file to ensure that it is targeting the correct version of .NET. You can do this by opening the project file in a text editor and looking for the following line:
    <TargetFramework>net6.0</TargetFramework>
    

    If this line is missing or has a different version number, you should update it to the correct version.

    1. If you're using a build server or continuous integration (CI) system, make sure that it is configured to use the correct version of the .NET SDK.

    Hope the above suggestion helps.

    On a side note, If you want assistance from Devops pipeline standpoint, You can ask the experts in the dedicated forum over here:
    https://stackoverflow.com/questions/tagged/devops https://developercommunity.visualstudio.com/spaces/21/index.html

    DevOps pipelines is currently not supported in the Q&A forums, the supported products are listed over here https://learn.microsoft.com/en-us/answers/products (more to be added later on).

    **

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    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.