Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Why is Bamboo dotnet publish running older 2.1 version of .NET Core SDK?

Zoe Hart December 5, 2019

I have a .net core 2.2 web app that has been building successfully in Bamboo for several months. Recently someone built a new Bamboo server (we're on premise, not in cloud) and my build began failing.

My original post stated that the failing script was running dotnet publish, but I realize now that I misread the log file. The error is occurring in the previous script task, which is running 

nuget restore

The first line in the log file (after it dumps out all of the bamboo environment variables) is 

MSBuild auto-detection: using msbuild version '15.9.21.664' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin'.

That is followed by four instances of the following error - probably one for each project in the solution: 

C:\Program Files\dotnet\sdk\2.1.509\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 2.2.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2. [E:\bamboo-home\xml-data\build-dir\RWDMIC-OAZD-JOB1\My.Service\MyProject.Service.csproj]

Does knowing that it is a nuget restore error and not a dotnet publish error generate any new hypotheses? 

I found that .net core 2.2 had not been installed on the new server, so I installed it. But the error persists and the error continues to reference .net core 2.1.

What would determine the .net core version within a nuget restore operation? 

1 answer

0 votes
Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 6, 2019

Hi @Zoe Hart,

As a first effort, I'd recommend taking a look to see what is being pointed to in the system path.  Also, what type of task are you using to execute this?  A script task?  If you are using a command task you might need to add a new system capability for the .NET Core 2.2 SDK you installed.

I hope that helps!

-Jimmy

Zoe Hart December 9, 2019

By "system path", do you mean the PATH environment variable on the server? 

I am executing the build with a Script task, not a Command task. The dotnet publish command is the entirety of the script.

And, for whatever it's worth, it was working before we rebuilt the server. So I think it is something missing or mis-configured in the server build. 

Zoe Hart December 9, 2019

I was able to navigate to the solution direction and successfully run the dotnet publish command manually, so the command and the server seem OK. 

The PATH environment variable just includes "C:\Program Files\dotnet\", which is where the dotnet.exe executable is located. So there is no version-specific location anywhere in the PATH environment variable. The selection of the version must happen within dotnet.exe and it is supposed to choose the latest installed version (2.2 in my case). And when I run it at the command line, it does choose 2.2. But when I run it in Bamboo, it does not. 

Zoe Hart December 9, 2019

I just realized that I misread the log file and thus misreported this problem. The error is occurring during a NuGet Restore command task, not the dotnet publish Script task. I've edited the original post to reflect this more accurate information. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events