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
The first line in the log file (after it dumps out all of the bamboo environment variables) is
MSBuild auto-detection: using msbuild version '184.108.40.2064' 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?
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!
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.
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.
G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events