0
votes

I am trying to build a .Net core project in Bamboo. when i am trying to build using command prompt its building successfully. But when build is triggered using Bamboo its showing unable to find the latest Microsoft.NET.SDK.

Previously the agent machine has 3.0.1 installed, the project was not building in that version. After updating it to latest version 3.1.101 the project is building successfully inside agent machine using cmd. In global.json the target SDK is "3.1.101". The bamboo is not identifying the latest version of SDK in agent machine.

Can anyone know why this problem is showing, should i need to update any configuration in bamboo?

Bamboo Build Log : Bamboo Build Log

build 29-Jan-2020 11:08:18 C:\Projects\WPF-JOB1\TestProject>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\ MSBuild\Current\Bin\MSBuild.exe" "TestProject.sln" /p:Configuration=Release /p:Platform="Any CPU" build 29-Jan-2020 11:08:21 Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework build 29-Jan-2020 11:08:21 Copyright (C) Microsoft Corporation. All rights reserved. build 29-Jan-2020 11:08:21
build 29-Jan-2020 11:08:21 Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch. build 29-Jan-2020 11:08:21 Build started 1/29/2020 4:38:21 PM. build 29-Jan-2020 11:08:22 Project "C:\Projects\WPF-JOB1\TestProject\TestProject.sln" on node 1 (default targets). build 29-Jan-2020 11:08:22 ValidateSolutionConfiguration: build 29-Jan-2020 11:08:22 Building solution configuration "Release|Any CPU". build 29-Jan-2020 11:08:22 ValidateProjects: build 29-Jan-2020 11:08:22 The project "Database" is not selected for building in solution configuration "Release|Any CPU". error 29-Jan-2020 11:08:24 A compatible installed .NET Core SDK for global.json version [3.1.101] from [C:\Projects\WPF-JOB1\ TestProject\global.json] was not found error 29-Jan-2020 11:08:24 Install the [3.1.101] .NET Core SDK or update [C:\Projects\WPF-JOB1\TestProject\global.json] with an installed .NET Core SDK: error 29-Jan-2020 11:08:24 It was not possible to find any installed .NET Core SDKs error 29-Jan-2020 11:08:24 Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from: error 29-Jan-2020 11:08:24 https://aka.ms/dotnet-download build 29-Jan-2020 11:08:24 C:\Projects\WPF-JOB1\TestProject\DAL\DAL.csproj : error : Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version. build 29-Jan-2020 11:08:24 Project "C:\Projects\WPF-JOB1\TestProject\TestProject.sln" (1) is building "C:\Projects\WPF-JOB1\ TestProject\DAL\DAL.csproj" (2) on node 1 (default targets). build 29-Jan-2020 11:08:24 C:\Projects\WPF-JOB1\TestProject\DAL\DAL.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found. build 29-Jan-2020 11:08:24 Done Building Project "C:\Projects\WPF-JOB1\TestProject\DAL\DAL.csproj" (default targets) -- FAILED.

1

1 Answers

1
votes

The issue is that Bamboo runs in a pseudo sandbox mode. Unless you've updated the capabilities on Bamboo it will not have any idea of the new changes. There are 2 things you can try:

  1. Try going to "Server capabilities" and selecting "Detect server capabilities".
  2. If that does not work, add dotnet as an executable Command (default path is C:\Program Files\dotnet\dotnet.exe). Switch your task to use this command instead of a command line script. This approach gives the advantage of easy scaling across linux, mac, and windows.