I’m trying to scan a .netcore 3.1 project and I’m not getting any results.
I suspected that this was due to the sonarcloud scan not being done in main/master branch however I have done this with some other projects and they at least produced lines of code.
Is there any support for c# on .netcore 3.1?
Are there any known issues and can anyone identify any issues from the attached code below?
The only thing different in this project to the others we host is we don’t run any tests - we are expecting zero code coverage however would have expected some other results in other areas to be produced. Are tests required or can an analysis be run just on the build alone?
The process in the yaml file is as follows:
pool:
vmImage: 'windows-latest'
# windows-2022
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- checkout: self
fetchDepth: 0
- task: DotNetCoreCLI@2
displayName: 'Restore Packages'
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'select'
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'Sonarcloud_<REDACTED>_ImportTool'
organization: '<REDACTED>-vsts'
scannerMode: 'MSBuild'
projectKey: '<REDACTED>-vsts_<REDACTED>-Import-Tool'
projectName: '<REDACTED> Import Tool'
extraProperties:
- task: UseDotNet@2
displayName: 'Use .NET Core 3.1 sdk'
inputs:
packageType: sdk
version: '3.1.x'
- task: UseDotNet@2
displayName: 'Install .Net 5 SDK'
inputs:
packageType: 'sdk'
version: '5.0.301'
- task: DotNetCoreCLI@2
displayName: 'Build <REDACTED>.App'
inputs:
command: 'build'
projects: '<REDACTED>.App/<REDACTED>.App.csproj'
arguments: '--configuration $(BuildConfiguration) --output $(Build.BinariesDirectory)/<REDACTED>.App'
- task: DotNetCoreCLI@2
displayName: 'Publish <REDACTED>.App'
inputs:
command: 'publish'
publishWebProjects: false
projects: '<REDACTED>.App/<REDACTED>.App.csproj'
arguments: '--configuration $(buildConfiguration) --output
$(Build.ArtifactStagingDirectory)/<REDACTED>.Application'
zipAfterPublish: true
- task: MSBuild@1
displayName: 'Build <REDACTED>'
inputs:
solution: '<REDACTED>/<REDACTED>.sqlproj'
msbuildArguments: '/p:PublishProfile=$(Build.BinariesDirectory)\<REDACTED>\<REDACTED>.publish.xml /p:publishUrl=$(Build.SourcesDirectory)'
- task: SonarCloudAnalyze@1
- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'