Hello,
We currently use BitBucket Pipelines to connect to Sonarcloud for our code review process. During the build, we’re getting the following error stating “The current .NET SDK does not support targeting.NET Core 2.2.” Our previous builds were pointing to "/usr/share/dotnet/sdk/2.2.207 and nothing has changed in our build process.
Has anyone experieinced something similar? If so what was the solution to change the “usr/share/dotnet/sdk” path to point to 2.2?
Thanks for the assistance in advance!
–
Pipeline output:
+ dotnet restore
/usr/share/dotnet/sdk/2.1.803/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.
bitbucket-pipeline snippet
- step: &build-test-sonarcloud
name: SonarQube
image: microsoft/dotnet:sdk
caches:
# - sonar
- dotnetcore
- node
script:
- echo "This script runs only on commit to branches with names that match the feature/* pattern."
- export PROJECT_NAME="ProjectName.sln"
- export TEST_NAME="ProjectName.sln"
- export PATH="$PATH:/root/.dotnet/tools"
# Set SonarQube prerequisites
- apt-get update; apt-get install -y openjdk-8-jre-headless
- curl -sL https://deb.nodesource.com/setup_12.x | bash
- apt-get install nodejs -yq
- cd ./src/Web
- npm install
- cd ../..
- dotnet tool install --global dotnet-sonarscanner
# Start Scanner
- dotnet sonarscanner begin /k:"path goes here"
# Build
- dotnet restore
- dotnet build $PROJECT_NAME
- dotnet test $PROJECT_NAME -o:"./output/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[xunit*]*" /p:CoverletOutput="./../../../"
# Publish Report to SonarQube
- dotnet sonarscanner end /d:sonar.login=$SONAR_TOKEN
- step: &check-quality-gate-sonarcloud
name: Check the Quality Gate on SonarCloud
script:
- pipe: sonarsource/sonarcloud-quality-gate:0.1.3