Unable to scan React typescript with .net core solution

Hi, I have two separate projects, one is in React typescript and another is backend in .net C#. We build both in the same build pipeline in two different tasks. Now when i try to run the SonarQube scan, the C# code is getting analyzed but not typescript.

  1. I tried copying only the typescipt code files to backend folder for scan but it gives these error during Sonar Analysis task:
  • Cannot find module ‘typescript’
  • TypeScript dependency was not found and it is required for analysis.
  1. I tried copying the entire package with node modules but that time .net build task gives compile error on typescript code.
    How can i get the typescript code analysis done?
    Azure devops yaml:
  • task: PowerShell@2
    inputs:
    targetType: ‘filePath’
    filePath: ‘$(System.DefaultWorkingDirectory)\Pipelines\Inline_Powershell_add_IP.ps1’
    displayName: ‘Inline Powershell’

    • task: SonarQubePrepare@4
      inputs:
      SonarQube: ‘SonarQube scan’
      scannerMode: ‘MSBuild’
      projectKey: ‘Test_Analyzer’
      projectName: ‘Test_Analyzer’

    • task: CmdLine@2
      displayName: “Build Frontend”
      inputs:
      script: |
      yarn --cwd frontend/ --frozen-lockfile && yarn --cwd frontend/ build-standalone

    • task: VSBuild@1
      displayName: “Build solution”
      inputs:
      solution: “Analyzer.sln”
      vsVersion: “16.0”
      msbuildArgs: ‘/p:GenerateProjectSpecificOutputFolder=true
      /p:OutDir=(build.artifactstagingdirectory) /p:WebPublishMethod=Package;DeployOnBuild=true;PackageAsSingleFile=true;PackageLocation=(build.artifactstagingdirectory)\Web /p:AutoParameterizationWebConfigConnectionStrings=false /p:GenerateSampleDeployScript=false /p:GenerateSampleDeployScript=false’
      platform: “(BuildPlatform)" configuration: "(BuildConfiguration)”

  • task: CopyFiles@2
    displayName: “Copy frontend files to web project for Sonar scan”
    inputs:
    SourceFolder: ‘(System.DefaultWorkingDirectory)\frontend' Contents: | ** TargetFolder: '(System.DefaultWorkingDirectory)\backend\Web\src’
    CleanTargetFolder: true

  • task: SonarQubeAnalyze@4
    displayName: ‘Run Code Analysis’

    - task: PowerShell@2
      inputs:
        targetType: 'filePath'
        filePath: '$(System.DefaultWorkingDirectory)\Pipelines\Inline_Powershell_r.ps1'
      displayName: 'Inline Powershell - r'

Hi Hema, welcome to the SonarSource Community!

Can you confirm which edition and version of SonarQube you’re running?

I think it may make the most sense to scan your separate projects as, well, separate projects within SonarQube. Which means you’d run the Prepare and Run tasks separately surrounding each appropriate set of build tasks.

I ask which edition you run because, depending upon the answer, there may then be follow-on solutions to allow you to see all the results combined together like a synthetic project if that’s your ultimate goal.

Hi Jeff,

we are unable to analyse .NET C# and TypeScript combined project in Developer Edition
Version 9.9 (build 65466).

Which version is needed to do so?

Hi @Jakub2013

I recommend against replying to a 3 year old thread in order to raise a new request for help. 9.9 should be perfectly capable of analyzing such a project; please post in a new unique thread and allow our community to give you proper troubleshooting assistance.