How to Mix of C# and C++ in Microsoft Azure DevOps build

How to Mix of C# and C++ in Microsoft Azure DevOps build?
The SonarCloud doc about “Solution Mix of C# and C++” is not clear.
We can build C# and got analysis resuilt with the

  • task: SonarCloudPrepare@1
    inputs:
    scannerMode: ‘MSBuild’
  • task: MSBuild@1
    inputs:
    solution: ‘solution.sln’
    Here C++ is not analyzed.

Then we use to build and analyze C++ this

  • task: SonarCloudPrepare@1
    inputs:
    scannerMode: ‘CLI’
    configMode: ‘manual’

  • task: PowerShell@2
    inputs:
    targetType: ‘inline’
    script: |
    & ‘build-wrapper-win-x86-64.exe’ --out-dir buildWrapperOutputDirectory ‘msbuild.exe’ ‘d\s\solution.sln’ /t:Rebuild /nodeReuse:False

Here C# is not analyzed and we got this message on the analyses task

Your project contains C# files which cannot be analyzed with the scanner you are using

How can we mixed both in one build? Is it possible to have a clear yaml example to help?

Hi,

Essentially, you need to do all the steps for both; use the build wrapper and the begin and end steps. Could you elaborate on what’s not clear about the docs?

 
Ann

The use of the begin end step is not documented for an Azure DevOps task.
There is no way to add two steps in an Azure task or we did not see it.
Not sure if adding two SonarCloudPrepare tasks (scannerMode msbuild + cli) will works

What is described in the doc is to add that.

  • task: PowerShell@2
    inputs:
    targetType: ‘inline’
    script: |
    & ‘build-wrapper-win-x86-64.exe’ --out-dir buildWrapperOutputDirectory ‘msbuild.exe’ ‘d\s\solution.sln’ /t:Rebuild /nodeReuse:False

and then C# code is not going to be analyzed where should the begin … end being added?

An example on how to implement mix C++ and C# in a yaml AzureDevOps will be helpful.

Hi,

Maybe the extension docs will be more helpful.

 
Ann

Thanks Ann,
The build extension is the one we use for the cpp analysis (task PowerShell with build-wrapper ), that works for cpp only.
What It does not work is to have both analysis in mixed cpp and C# solution.
Analysis only C# works, Analysis only Cpp works. Mixing both we do not find a way that let have C++ and C# analysis report.

Hi,

Did you try what’s in the extension docs specifically for “Analyzing a C++ project”? Because it uses

  • a Prepare Analysis Configuration task
  • the build wrapper + MSBuild
  • a Run Code Analysis task

That should get the job done for both languages.

 
Ann

Hi Ann, what we want is to mix both language in on report as the solution is a code with mixed C# and C++. What you told me to check is for one language or the another one but not for both as mixed code in one solution.
If we do what you propose then we have this:

Your project contains C# files which cannot be analyzed with the scanner you are using

Hi,

You’re saying you used the prepare task, built with MSBuild, ran the code analysis/end task, and it only analyzed your C++ code?

Can you share the analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

Hello,
here is the build Azure pipeline log.
where it has a WARN: Your project contains C# files which cannot be analyzed with the scanner you are using

The task used

   - task: PowerShell@2
     enabled: true
     displayName: 'SonarCloud Build'
     inputs:
       targetType: 'inline'
       script: |
         & '$(Agent.TempDirectory)\buildWrapper\build-wrapper-win-x86\build-wrapper-win-x86-64.exe' --out-dir buildWrapperOutputDirectory 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\msbuild.exe' '$(Agent.BuildDirectory)\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication.sln' /t:Rebuild /nodeReuse:False
##[section]Starting: SonarCloud Build
==============================================================================
Task         : PowerShell
Description  : Run a PowerShell script on Linux, macOS, or Windows
Version      : 2.220.0
Author       : Microsoft Corporation
==============================================================================
##[debug]INPUT_SCRIPT: '& 'D:\a\_temp\buildWrapper\build-wrapper-win-x86\build-wrapper-win-x86-64.exe' --out-dir buildWrapperOutputDirectory 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\msbuild.exe' 'D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication.sln' /t:Rebuild /nodeReuse:False'
========================== Starting Command Output ===========================
##[debug]Entering Invoke-VstsTool.
##[debug] Arguments: '-NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\7cfdf009-57cd-4fd6-913b-33f70063fd9c.ps1'"'
##[debug] FileName: 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
##[debug] WorkingDirectory: 'D:\a\1\s'
##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\7cfdf009-57cd-4fd6-913b-33f70063fd9c.ps1'"
MSBuild version 17.6.3+07e294721 for .NET Framework
Build started 6/23/2023 6:11:23 AM.

Project "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication.sln" on node 1 (Rebuild target(s)).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|Any CPU".
Project "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication.sln" (1) is building "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication\SomeConsoleApplication.csproj" (2) on node 1 (Rebuild target(s)).
CoreCompile:
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /fullpaths /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Net.Http.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\SomeConsoleApplication.exe /subsystemversion:6.00 /target:exe /utf8output /langversion:7.3 Program.cs Properties\AssemblyInfo.cs "obj\Debug\.NETFramework,Version=v4.8.AssemblyAttributes.cs"
Done Building Project "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication\SomeConsoleApplication.csproj" (Rebuild target(s)).

Project "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication.sln" (1) is building "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplicationTest\SomeConsoleApplicationTest.csproj" (3) on node 1 (Rebuild target(s)).
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /fullpaths /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll" /reference:D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication\bin\Debug\SomeConsoleApplication.exe /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\SomeConsoleApplicationTest.dll /subsystemversion:6.00 /target:library /utf8output /langversion:7.3 ProgramTests.cs Properties\AssemblyInfo.cs "obj\Debug\.NETFramework,Version=v4.8.AssemblyAttributes.cs"
  SomeConsoleApplicationTest -> D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplicationTest\bin\Debug\SomeConsoleApplicationTest.dll
Done Building Project "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplicationTest\SomeConsoleApplicationTest.csproj" (Rebuild target(s)).

Project "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication.sln" (1) is building "D:\a\1\s\sonarqube-scanner-msbuild\Outputs\Prints\SomeConsolePrints\SomeConsolePrints.csproj" (4) on node 1 (Rebuild target(s)).
CoreCompile:
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /fullpaths /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Net.Http.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\SomeConsolePrints.exe /subsystemversion:6.00 /target:exe /utf8output /langversion:7.3 Program.cs Properties\AssemblyInfo.cs "obj\Debug\.NETFramework,Version=v4.8.AssemblyAttributes.cs"
 Done Building Project "D:\a\1\s\sonarqube-scanner-msbuild\Outputs\Prints\SomeConsolePrints\SomeConsolePrints.csproj" (Rebuild target(s)).

Project "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication.sln" (1) is building "D:\a\1\s\sonarqube-scanner-msbuild\CppProject\CppProject.vcxproj" (5) on node 1 (Rebuild target(s)).
PrepareForBuild:
  Creating directory "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\x64\Debug\".
  Creating directory "x64\Debug\CppProject.tlog\".
InitializeBuildStatus:
  Creating "x64\Debug\CppProject.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\CL.exe /c /ZI /JMC /nologo /W3 /WX- /diagnostics:column /sdl /Od /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /permissive- /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"x64\Debug\\" /Fd"x64\Debug\vc142.pdb" /external:W3 /Gd /TP /FC /errorReport:queue CppProject.cpp
   CppProject.cpp
 Link:
   C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\link.exe /ERRORREPORT:QUEUE /OUT:"D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\x64\Debug\CppProject.exe" /INCREMENTAL /ILK:"x64\Debug\CppProject.ilk" /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\x64\Debug\CppProject.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\x64\Debug\CppProject.lib" /MACHINE:X64 x64\Debug\CppProject.obj
  CppProject.vcxproj -> D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\x64\Debug\CppProject.exe
Done Building Project "D:\a\1\s\sonarqube-scanner-msbuild\CppProject\CppProject.vcxproj" (Rebuild target(s)).
Done Building Project "D:\a\1\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication.sln" (Rebuild target(s)).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:01:00.74
##[debug]$LASTEXITCODE: 0
##[debug]Exit code: 0
##[debug]Leaving Invoke-VstsTool.
##[debug]Leaving D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.220.0\powershell.ps1.
##[section]Finishing: SonarCloud Build

##[section]Starting: SonarCloudAnalyze
==============================================================================
Task         : Run Code Analysis
Description  : Run scanner and upload the results to the SonarCloud server.
Version      : 1.40.0
Author       : sonarsource
==============================================================================
##[debug]jdkversion=JAVA_HOME_11_X64
##[debug]SONARQUBE_SCANNER_MODE=CLI
##[debug]Trying to resolve JAVA_HOME_11_X64 from environment variables...
##[debug]JAVA_HOME_11_X64=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.19-7\x64
##[debug]JAVA_HOME_11_X64 was found with value C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.19-7\x64, will switch to it for Sonar scanner...
##[debug]JAVA_HOME=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.372-7\x64
##[debug]set JAVA_HOME=C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.19-7\x64
INFO: Scanner configuration file: D:\a\_tasks\SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1\1.40.0\sonar-scanner\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.8.0.2856
INFO: Java 11.0.19 Eclipse Adoptium (64-bit)
INFO: Windows Server 2022 10.0 amd64
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: **/build-wrapper-dump.json, **/SomeConsoleApplicationTest/**/*, Outputs/**/*
INFO:   Excluded tests: **/*
INFO:   Excluded sources for duplication: **/AssemblyInfo.cs
INFO: 30 files indexed
INFO: 16 files ignored because of inclusion/exclusion patterns
INFO: 20 files ignored because of scm ignore settings
INFO: Quality profile for cpp: Sonar way
INFO: Quality profile for cs: Sonar way
INFO: ------------- Run sensors on module SonarExamples
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=187ms
INFO: Sensor cache enabled
INFO: Load sensor cache
INFO: Load sensor cache (738 bytes) | time=517ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=0ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=0ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor CFamily [cpp]
INFO: CFamily plugin version: 6.45.0.62016
INFO: Using build-wrapper output: D:\a\1\s\buildWrapperOutputDirectory\build-wrapper-dump.json
INFO: Available processors: 2
INFO: Using 2 threads for analysis.
INFO: Found empty cache on server
INFO: [pool-6-thread-1] D:/a/1/s/sonarqube-scanner-msbuild/CppProject/CppProject.cpp
INFO: PCH: unique=0 use=0 (forceInclude=0,throughHeader=0,firstInclude=0) out of 1 (forceInclude=0,throughHeader=0)
INFO: Z3 refutation rate: 0 out of 0
INFO: SE: 1 out of 1
INFO: Subprocess(es) done in 3691ms
INFO: 0/1 files marked as unchanged
INFO: Cache: 0/1 hits, 19416 bytes
INFO: 1 compilation units analyzed
INFO: Sensor CFamily [cpp] (done) | time=6240ms
INFO: ------------- Run sensors on project
INFO: Sensor C# [csharp]
WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html
INFO: Sensor C# [csharp] (done) | time=0ms
INFO: Sensor Analysis Warnings import [csharp]
INFO: Sensor Analysis Warnings import [csharp] (done) | time=0ms
INFO: Sensor C# File Caching Sensor [csharp]
WARN: Incremental PR analysis: Could not determine common base path, cache will not be computed. Consider setting 'sonar.projectBaseDir' property.
INFO: Sensor C# File Caching Sensor [csharp] (done) | time=0ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=94ms
INFO: SCM Publisher SCM provider for this project is: git
INFO: SCM Publisher 5 source files to be analyzed
WARN: Shallow clone detected, no blame information will be provided. You can convert to non-shallow with 'git fetch --unshallow'.
INFO: SCM Publisher 0/5 source files have been analyzed (done) | time=16ms
INFO: Analysis report generated in 2773ms, dir size=220 KB
INFO: Analysis report compressed in 15ms, zip size=47 KB
INFO: Analysis report uploaded in 329ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=SWTITOPS_SonarExamples&branch=feature%2Fsonar-mix-csharp-cpp&resolved=false
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=AYjm4uZDDVKCYupQOYSi
INFO: Sensor cache published successfully
INFO: Analysis total time: 25.796 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:00.515s
INFO: Final Memory: 38M/130M
INFO: ------------------------------------------------------------------------

Hi,

Can you share the full pipeline?

You’re showing me an MSBuild /t:Rebuild but not the analysis command. I’m expecting to see the equivalent of this example from the docs

SonarScanner.MSBuild.exe begin /k:"cs-and-cpp-project-key" /n:"My C# and C++ project" /v:"1.0" /d:sonar.cfamily.build-wrapper-output="build_wrapper_output_directory"
build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory MSBuild.exe /t:Rebuild /nodeReuse:False
SonarScanner.MSBuild.exe end

 
Ann

Hi,

Maybe you’ll find this helpful:

 
Ann

Hello Ann, the build have the same setup than the one you propose.
See my 1st post where the setup is described.
This do not work on SonarCloud.

Here is the analysis command quiet simple on Azure DevOps. Just one line nothing that we can add here.

- task: SonarCloudAnalyze@1

Good news, This morning the mixed C++/C# build is working.
I did not change anything in the pipeline. Looks like there was an update from SonarCloud that fix the problem
We still have the WARN: our project contains C# files which cannot be analyzed with the scanner you are using. This is now a warning and C# and Cpp is analyzed, happy with that.

In fact it still does not work. I introduce a Security Hotspot and this is not detected in C# and C++ build with the build-wrapper. Without the build wrapper the security issue is detected but C++ issue is not detected. See pictures


A solution can be to setup a mono repo just for the C++ analysis and use the C# in the single repository. Something like this in the build pipeline.
Not a great solution has we have to run the same build twice.

  • task: SonarCloudPrepare@1 this for C#
    here : single repos project key

  • task: build demo.sln

  • task: SonarCloudAnalyze@1

  • task: SonarCloudPrepare@1 this for C++
    here : mono repos project key

  • task: build demo.sln with build-wrapper

  • task: SonarCloudAnalyze@1

Hi @ganncamp

Here is the full solution, note the usage of JAVA_HOME_17_X64


  variables:
    SonarCloud_Build_Wrapper_url: https://sonarcloud.io/static/cpp/build-wrapper-win-x86.zip
  - task: SonarCloudPrepare@1
    displayName: SonarCloudPrepare build-wrapper
    inputs:
      SonarCloud: 'SonarCloud' # Name of the SonarCloud service connection you created
      organization: '....'
      scannerMode: 'MSBuild'
      configMode: 'manual'
      projectKey: '...'
      projectName: '...'
      extraProperties: |
        sonar.verbose=true
        sonar.cfamily.build-wrapper-output=s\buildWrapperOutputDirectory
        sonar.sourceEncoding=UTF-8     
        sonar.exclusions = **/SomeConsoleApplicationTest/**/*,**/Outputs/**/*
        sonar.test.exclusions = **/*
  - task: PowerShell@2
    displayName: 'Download and expand build wrapper'
    enabled: true
    inputs:
      targetType: 'inline'
      script: |
        Invoke-WebRequest -Uri '$(SonarCloud_Build_Wrapper_url)' -OutFile '$(Agent.TempDirectory)\build-wrapper.zip'
        Expand-Archive -Path '$(Agent.TempDirectory)\build-wrapper.zip' -DestinationPath '$(Agent.TempDirectory)/buildWrapper' -Force

  - task: PowerShell@2
    displayName: 'SonarCloud Build with build-wrapper'
    enabled: true
    inputs:
      targetType: 'inline'
      script: |
        & '$(Agent.TempDirectory)\buildWrapper\build-wrapper-win-x86\build-wrapper-win-x86-64.exe' --out-dir buildWrapperOutputDirectory 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\msbuild.exe' '$(Agent.BuildDirectory)\s\sonarqube-scanner-msbuild\CSharpProject\SomeConsoleApplication.sln' /t:Rebuild /nodeReuse:False
  - task: SonarCloudAnalyze@1
    inputs:
      jdkversion: 'JAVA_HOME_17_X64'
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.