Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Use the latest Nuget Tool version for .NET 6

Victor H Garcia February 28, 2022 edited

How can I use the latest version of the nuget tool when restoring the packages of a .NET 6 project? I noticed it is using old version that is preventing to restore successfully all my project packages.

Any hint is always welcome, please.

btw, On Azure DevOps, I got recommended to use:

- task: NuGetToolInstaller@1
However, I don't know how to use it on Bitbucket Pipelines.
Thanks in advance,
Victor

1 answer

1 accepted

0 votes
Answer accepted
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2022

Hi, Victor, thank you for reaching out to Atlassian Community.

In order to properly assist you, could you please share the following information with us?

  • What build image are you using?

  • Which Nuget are you using? 

  • What error/behavior are you getting? 

Thank you!

Kind regards,
Caroline

Victor H Garcia March 3, 2022
Thanks @Caroline R  for your response.


The bitbucket-pipelines.yml I'm using is the following:


image: microsoft/dotnet:sdk

pipelines:

branches:

develop:

- step:

name: Build

caches:

- dotnetcore

script:

- dotnet restore src/solution_name.sln

- dotnet build src/solution_name.sln --no-restore --configuration Release

The error, I'm getting is:

Images used:
build : docker.io/microsoft/dotnet@sha256:4db9513d5b1bcf4b88c5700f9b831908d435d9771fd28a338b123e5ab8eec036
+ dotnet restore src/solution_name.sln
/opt/atlassian/pipelines/agent/build/src/project/project_name.csproj : error NU1202: Package MVCCaching.Kentico.Core 13.0.2 is not compatible with net60 (.NETFramework,Version=v6.0). Package MVCCaching.Kentico.Core 13.0.2 supports: netcoreapp3.1 (.NETCoreApp,Version=v3.1) [/opt/atlassian/pipelines/agent/build/src/solution_name.sln]
Restore failed in 1.25 sec for /opt/atlassian/pipelines/agent/build/src/project/project_name.csproj.
/opt/atlassian/pipelines/agent/build/src/project2/project_name_2.csproj : error NU

Basically, what I want to build is a project on .NET 6 ASP.NET MVC project, however, I tried to use well the following images without luck. The image I was setting is mcr.microsoft.com/dotnet/core/sdk:6.0 however, I got the following error:

rpc error: code = NotFound desc = failed to pull and unpack image "mcr.microsoft.com/dotnet/core/sdk:6.0": failed to resolve reference "mcr.microsoft.com/dotnet/core/sdk:6.0": mcr.microsoft.com/dotnet/core/sdk:6.0: not found
Let me know if you need anything else from me.
Kind Regards,
Victor
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2022

Hi, Victor. 

Thanks for getting back to us and sharing the additional information. Before we continue, I just would like to set the expectation that we are not proficient with how .Net technology works, but we will assist as best as possible from our side.

In order for us to verify if the issue is related to the Pipeline, you will need to debug the build locally and let us know the result. You can access the following link to check how to perform this test:

The error that you are getting while pulling the image mcr.microsoft.com/dotnet/core/sdk:6.0 is actually expected as the image you are specifying doesn’t exist. Could you please try to use mcr.microsoft.com/dotnet/sdk:6.0 to pull the image if you would like to use the .Net SDK 6.0 version as mentioned here?

Please let us know how it goes and don't hesitate to ask for any further information if needed. 

Kind regards, 
Caroline 

Victor H Garcia March 5, 2022

Hello @Caroline R ,

Thank you for your help! By updating the image to the one you shared on the comment, the build of my .NET 6 project worked very good.

Thank you so much for sharing the debugging details as well. I will definitely configure it locally for tests.

Regards,
Victor

Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2022

Hi, Victor! 

Thanks for getting back to us! I'm glad to know it worked :)

Kind regards, 
Caroline 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events