Azure Devops Build fail with .deployproj with missing parameter "Language" error

Template for a good bug report, formatted with Markdown:

  • versions used: VSTS SonarCloud Version 1.4.0 - SonarScanner for MSBuild 4.4.1
  • error observed:
CreateProjectSpecificDirs:
2018-10-12T18:53:18.3982024Z   Creating directory "D:\a\1\.sonarqube\conf\0".
2018-10-12T18:53:20.4236768Z ##[error]D:\a\1\.sonarqube\bin\targets\SonarQube.Integration.targets(381,5): Error MSB4044: The "GetAnalyzerSettings" task was not given a value for the required parameter "Language".
2018-10-12T18:53:20.4251438Z D:\a\1\.sonarqube\bin\targets\SonarQube.Integration.targets(381,5): error MSB4044: The "GetAnalyzerSettings" task was not given a value for the required parameter "Language". [D:\a\1\s\AzureInfra\AzureInfra.deployproj]
2018-10-12T18:53:20.4618851Z Done Building Project "D:\a\1\s\AzureInfra\AzureInfra.deployproj" (default targets) -- FAILED.
  • VS 2017 solution with a Azure Resource Deployment project. Prepare analysis hasn’t changed. Build starting failing since release 1.4 on October 12 using SonarScanner for MSBuild 4.4.1. When solution is compiled in CI pipeline, builds crash with the error above.
  • potential workaround: Tried adding sonar.exclusions=*.deployproj in extraProperties of inputs but exclusion is not applied, build still fails.

P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour

1 Like

+1 for this issue. Have noticed the same thing and its killing my builds.

Hi,

We are noticing the same issue.
See error message below.

f:\BuildSource\VSTS1\6.sonarqube\bin\targets\SonarQube.Integration.targets(381,5): Error MSB4044: The “GetAnalyzerSettings” task was not given a value for the required parameter “Language”.
Process ‘msbuild.exe’ exited with code ‘1’.
f:\BuildSource\VSTS1\6.sonarqube\bin\targets\SonarQube.Integration.targets(381,5): Error MSB4044: The “GetAnalyzerSettings” task was not given a value for the required parameter “Language”.
Process ‘msbuild.exe’ exited with code ‘1’.

Is there any workaround? We started noticing this error message on 2018/10/12.

Exclude the deployproj files using this documenation: https://docs.sonarqube.org/display/SCAN/Excluding+Artifacts+from+the+Analysis

@quintush,

Thank you. Excluding analysis fixed the build.

I get the same error on an .sfproj. Same solution?

Same problem, first noticed on 12/10/2018.
Unfortunately @quintush work around is not viable, as that would mean editing 30+ dcproj files, pull requests, approvals, etc etc. to work around a problem that did not exist a week ago.
Is there a fix planned by Sonarcloud. Or will this remain as expected behaviour and require customers to make dev changes to resolve?
Is anyone aware of a workaround that can be done in the build definition, this would be fine as it means 1 change in a task group common to all project build.

Maybe this?

{
  "name": "extraProperties",
  "type": "multiLine",
  "label": "Additional Properties",
  "defaultValue":
    "# Additional properties that will be passed to the scanner, \n# Put one key=value per line, example:\n# sonar.exclusions=**/*.bin",
  "required": false,
  "properties": {
    "resizable": "true",
    "rows": "5"
  },

I tired adding that to the yml build and it did not work.

Solution suggested @quintush fixed it. Note that this fix requires to make changes to the solution files rather than sonar configurations.

This does work, but it doesn’t feel like a good fix.

Since we are using Azure devops and not annotating any SonarQube specific code in our .NET solution the provided workaround is not valid for us. What would also help is to specify a specific version of SonarQube to use instead of the latest 4.x version from wihin our build pipeline.
It broke our pipeline and our build agent, since it left the agent in an inconsistent state (all kind of SonarQube dll’s were not cleaned, resulting in even more errors).
To fix the agent, we had to move the “Run code analysis” task before the build, so that it could fail gracefully and clean up all the SonarQube dependencies. Hopefully this helps anyone.

Ya – not at all nice.
All things were running nicely in my Azure pipelines and Bang, all the C# builds start failing.

Did someone make a change behind the scenes?

Here’s a powershell script I wrote to automatically implement @quintush’s fix on all deployproj files in the Azure DevOps sources directory. I have it running towards the start of the build, before the SonarQube “prepare analysis” step.

Not the most elegant solution but it works.

$path = $env:BUILD_SOURCESDIRECTORY

$sonarExclude = @"
	</PropertyGroup>  
	<PropertyGroup>
	<!-- Exclude the project from analysis -->
	<SonarQubeExclude>true</SonarQubeExclude>
	</PropertyGroup>
"@

foreach($deployproj in Get-ChildItem -Path $path -Recurse -Filter *.deployproj)
{
	$content = Get-Content $deployproj.FullName
	[regex]$pattern = "</PropertyGroup>"
	$content = $pattern.replace($content, $sonarExclude, 1)
	Set-Content -Path $deployproj.FullName -Value $content
}

@all, the issue is being tracked by Scanner for MSBuild issue #589. We’ve released new versions of the scanner and the VSTS tasks to address the issue. Please let us know if you are still experiencing problems.
Please accept our apologies for the inconvenience.

Root cause: a property in one of our custom MSBuild tasks was marked as Required in version 4.4.1. The Scanner for MSBuild is embedded in the Azure DevOps SonarCloud and SonarQube extensions, which were re-released on Friday. The new versions of the extensions were minor updates, so they would have been automatically deployed by the build agents the next time a build using the task was executed.

2 Likes

Thnx, works like a charm!

Thanks for the update @corradin!

Thanks for the fix Duncan and keeping us all updated on the progress. Our builds with sonarcloud analysis are back to ‘green’. Yay.