ALM/CI Used: Azure DevOps
Language of repo - c#, javascript
I’m having an issue whereby my SonarScans are showing the “Last Analysis has warnings” message. The message states that:
The analysis using MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.
I believe I have forced MSBuild 16.0 to run but these alerts still persist. I can confirm with the logs that MSbuild 16.0 is running however there maybe something I have missed and maybe it is reverting back.
I’m at a bit of a loss. Am I missing something? I can provide some logs privately upon request if required.
Pipeline files:
- Sonar.yml
- Sonar-template.yml
Sonar.yml
variables:
NUGET_PACKAGES: $(Build.SourcesDirectory)\.nuget\packages
BuildConfiguration: 'Release'
BuildPlatform: 'AnyCPU'
msBuildVersion: '16.0'
projectName: 'core' # Something must be declared here to allow the jobs to validate the service connection
projectName_alt: 'Core' # Something must be declared here to allow the jobs to validate the service connection
- stage: RunSonarcloud
dependsOn: PipelineSetup
jobs:
- job: Academy
cancelTimeoutInMinutes: 1
variables:
projectName : 'academy'
projectName_alt : 'Academy'
run_tests : false
pool:
vmImage: windows-2019
steps:
- template: sonar-template.yml
sonar-template.yml
steps:
- checkout: self
fetchDepth: 0
fetchTags: false
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '[Redacted]_V2.sln'
verbosityRestore: Quiet
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'
verbosityRestore: Quiet
- task: UseDotNet@2
inputs:
version: 3.1.x
displayName: 'Use dotNet 3.1'
- task: SonarCloudPrepare@2
inputs:
SonarCloud: 'SonarCloud_[Redacted]_V2_$(projectName)'
organization: '[Redacted]-vsts'
scannerMode: 'MSBuild'
projectKey: '[Redacted]-vsts_[Redacted]_Web_App_[Redacted]_$(projectName_alt)'
projectName: '[Redacted]-vsts_[Redacted]_Web_App_[Redacted]_$(projectName_alt)'
- task: CopyFiles@2
displayName: 'Copy test.runsettings to: $(Agent.TempDirectory)'
inputs:
Contents: |
**.runsettings
TargetFolder: '$(Agent.TempDirectory)'
- task: VSBuild@1
displayName: 'Build $(projectName)'
inputs:
solution: 'Source/[Redacted]_$(projectName)/[Redacted]_$(projectName).csproj'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=$(build.stagingDirectory) /p:UseMerge=true /p:SingleAssemblyName=AppCode /p:PublishProfile=DockerPublishProfile.pubxml /p:Verbosity=quiet
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
maximumCpuCount: true
msbuildArchitecture: x64
logProjectEvents: false
enableDefaultLogger: false
customVersion: $(msBuildVersion)
- task: VSBuild@1
displayName: 'Build [Redacted]_$(projectName) Tests'
inputs:
solution: 'Source/[Redacted]_$(projectName)*Tests/*Tests.csproj'
msbuildArgs: '/p:PackageLocation=$(build.stagingDirectory)\[Redacted]_$(projectName).Tests /p:UseMerge=true /p:SingleAssemblyName=AppCode /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:OutDir=$(Build.ArtifactStagingDirectory)\$(projectName)_Tests
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
maximumCpuCount: true
customVersion: $(msBuildVersion)
continueOnError: true
condition: eq(variables.run_tests, 'true')
- task: VSTest@2
displayName: '[Redacted]_$(projectName).Tests'
inputs:
testAssemblyVer2: |
**\[Redacted]_$(projectName)*Tests.dll
!**\obj\**
searchFolder: '$(Build.ArtifactStagingDirectory)'
resultsFolder: '$(Agent.TempDirectory)\TestResults\[Redacted]_$(projectName)'
codeCoverageEnabled: true
testRunTitle: '[Redacted]_$(projectName)_Tests'
runInParallel: true
condition: eq(variables.run_tests, 'true')
continueOnError: True
- task: SonarCloudAnalyze@2
displayName: 'Run Code Analysis'
- task: SonarCloudPublish@2
displayName: 'Publish Quality Gate Result'