# SonarQubePrepare@7 Azure DevOps Task not reading sonar.projectBaseDir

**URL:** <https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688>\
**Category:** SonarQube Server / Community Build\
**Tags:** dotnet\
**Created:** [October 22, 2024, 6:47pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688 "2024-10-22T18:47:18Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnesta-lh](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jnesta-lh/32/63355_2.png) [@jnesta-lh](https://community.sonarsource.com/u/jnesta-lh)\
**Post date:** [October 22, 2024, 6:47pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/1 "2024-10-22T18:47:19Z")

</div>

My versions:

- SonarQube Version: v10.6 (92116)[ACTIVE]
- Azure DevOps Task: SonarQubePrepare@7.0.1

I have an Azure DevOps task like this:

```auto
      - task: SonarQubePrepare@7
        inputs:
          SonarQube: SonarQube New
          projectKey: LogixStaffing
          projectName: LogixStaffing
          projectVersion: LogixStaffing-Master
          extraProperties: |
            sonar.verbose=true
            sonar.projectBaseDir=C:\_IT\LogixApplications\apps\mvc\LogixStaffing

```

It generates the output that is contained in the attached “SonarQubePrepare.log” file.

[SonarQubeAnalyze.log](https://community.sonarsource.com/uploads/short-url/6BymRmWh1BpHXifKRFpnUFFJDWQ.log) (267.8 KB)

However, it seems like the “projectBaseDir” config entry is not being read correctly, because the subsequent “SonarQubeAnalyze@7” task fails. See the attached “SonarQubeAnalyze.log” file.

[SonarQubePrepare.log](https://community.sonarsource.com/uploads/short-url/wQ2vwn4lxAZotp9nD52JdkIIeR.log) (11.4 KB)

Is this the correct format for specifying the “projectBaseDir” option? Why is it not being picked up correctly?

---

<div class="post-metadata">

**Author:** ![Devin\_Quince](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/devin_quince/32/31982_2.png) [@Devin\_Quince](https://community.sonarsource.com/u/Devin_Quince)\
**Post date:** [October 22, 2024, 10:15pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/2 "2024-10-22T22:15:00Z")

</div>

> [@jnesta-lh](#):
>
> projectBaseDir

I add to ticks with the upgrade  
`'sonar.projectBaseDir='$(Build.SourcesDirectory)/ ****'`

---

<div class="post-metadata">

**Author:** ![jnesta-lh](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jnesta-lh/32/63355_2.png) [@jnesta-lh](https://community.sonarsource.com/u/jnesta-lh)\
**Post date:** [October 23, 2024, 8:31pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/3 "2024-10-23T20:31:50Z")

</div>

Devin\_Quince: Some questions about that code:

1. Why do you have 3 quotes? That looks like a bug, because there is no closing quote.
2. What do the four asterisks represent? Are they a glob pattern? Where is this documented?
3. According to the documentation, you are not supposed to add a glob pattern to the project base directory, because it is exactly that: a base directory specification, not an array of files to include.

Furthermore, I tried it out, and it just gives me this error:

```auto
##[error]Unhandled Exception:
##[error]System.ArgumentException: Illegal characters in path.

```

Can you clarify?

---

<div class="post-metadata">

**Author:** ![Devin\_Quince](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/devin_quince/32/31982_2.png) [@Devin\_Quince](https://community.sonarsource.com/u/Devin_Quince)\
**Post date:** [October 23, 2024, 9:02pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/4 "2024-10-23T21:02:04Z")

</div>

\*\*\* isredacted info. They are ticks and not quotes and not sure why 3 works. Try this.  
`'sonar.projectBaseDir='$(Build.SourcesDirectory)/foldername'`

---

<div class="post-metadata">

**Author:** ![jnesta-lh](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jnesta-lh/32/63355_2.png) [@jnesta-lh](https://community.sonarsource.com/u/jnesta-lh)\
**Post date:** [October 23, 2024, 9:34pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/5 "2024-10-23T21:34:14Z")

</div>

To clarify, the ’ character is called an apostrophe or a single quote. It is not a tick.  
I tried adding 3 single quotes, but it makes SonarQube crash with a syntax error, as expected. Thanks anyways, I will wait for another to respond.

---

<div class="post-metadata">

**Author:** ![denis.troller](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/denis.troller/32/49117_2.png) [@denis.troller](https://community.sonarsource.com/u/denis.troller)\
**Post date:** [October 24, 2024, 6:44am UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/6 "2024-10-24T06:44:30Z")

</div>

Hi @jnesta-lh,

This is a bug we discovered yesterday in the way extraProperties are handled in v3 tasks on Windows agents.

[This has been fixed in v7.0.2 of the extension](https://community.sonarsource.com/t/sonarqube-and-sonarcloud-extensions-for-azure-devops-v7-0-2-v3-0-2/128912).

Denis

---

<div class="post-metadata">

**Author:** ![jnesta-lh](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jnesta-lh/32/63355_2.png) [@jnesta-lh](https://community.sonarsource.com/u/jnesta-lh)\
**Post date:** [October 24, 2024, 2:14pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/7 "2024-10-24T14:14:02Z")

</div>

Dennis,  
Thank you. However, even after updating to version 7.0.2, I still experience the same behavior. Can you advise?

In this case, I do not think that “removing backslashes” would be an issue, because then I would expect SonarQube to be throwing an error something along the lines of:

```auto
The path you specified in the "projectBaseDir" option does not exist: CFooBar

```

However, I do not get any errors of this nature.

---

<div class="post-metadata">

**Author:** ![denis.troller](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/denis.troller/32/49117_2.png) [@denis.troller](https://community.sonarsource.com/u/denis.troller)\
**Post date:** [October 24, 2024, 2:26pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/8 "2024-10-24T14:26:28Z")

</div>

OK, then let me flag that for our engineers to look at.  
Thanks for following up.

---

<div class="post-metadata">

**Author:** ![denis.troller](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/denis.troller/32/49117_2.png) [@denis.troller](https://community.sonarsource.com/u/denis.troller)\
**Post date:** [October 25, 2024, 8:44am UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/10 "2024-10-25T08:44:51Z")

</div>

Hi @jnesta-lh

Did that pipeline use to work previously?  
Would you mind sharing the whole (redacted) pipeline here?

Denis

---

<div class="post-metadata">

**Author:** ![costin.zaharia](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/costin.zaharia/32/62600_2.png) [@costin.zaharia](https://community.sonarsource.com/u/costin.zaharia)\
**Post date:** [October 25, 2024, 8:49am UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/11 "2024-10-25T08:49:49Z")

</div>

Hi Devin,

Could you please send us the logs again, in verbose mode, after the update to 7.0.2?

---

<div class="post-metadata">

**Author:** ![jnesta-lh](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jnesta-lh/32/63355_2.png) [@jnesta-lh](https://community.sonarsource.com/u/jnesta-lh)\
**Post date:** [October 25, 2024, 1:49pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/13 "2024-10-25T13:49:43Z")

</div>

Costin,

Sure thing.

[SonarQubeAnalyze.txt](https://community.sonarsource.com/uploads/short-url/5eb9PoMZZw4XXBpY7JHh9tmSOlh.txt) (267.2 KB)  
[SonarQubePrepare.txt](https://community.sonarsource.com/uploads/short-url/4kpvXSHQosR6PFVp8kQsSimuvC2.txt) (11.4 KB)

See the attached logs, which are on version 7.0.2.

For context, here is the Azure DevOps pipeline that is invoking it, a file called “dotnetframework\_48\_build.yml”:

```auto
parameters:
  - name: projectName
    type: string
  # The full path to the code directory to check.
  # For example: C:\_IT\LogixHealth\apps\mvc\LogixStaffing
  - name: codeDirectory
    type: string
  - name: projectSolutionName
    displayName: The name of the ".sln" file to compile.
    type: string
  - name: artifactDirectory
    type: string
  - name: artifactName
    type: string
  - name: validate
    displayName: Whether to run SonarQube checks.
    type: boolean

steps:
  - task: NuGetToolInstaller@1
    displayName: Install NuGet
    inputs:
      checkLatest: true
  - task: NuGetCommand@2
    displayName: Install dependencies
    env:
      NODE_EXTRA_CA_CERTS: C:\_IT\BEDROOTCA001.cer
    inputs:
      command: restore
      restoreSolution: ${{ parameters.codeDirectory }}\${{ parameters.projectSolutionName }}
      feedsToUse: select
      vstsFeed: LogixLibrary
  - ${{ if eq(parameters.validate, true) }}:
      - task: SonarQubePrepare@7
        inputs:
          SonarQube: SonarQube New
          projectKey: ${{ parameters.projectName }}
          projectName: ${{ parameters.projectName }}
          projectVersion: ${{ parameters.projectName }}-Master
          extraProperties: |
            sonar.verbose=true
            sonar.projectBaseDir=C:\_IT\LogixApplications\apps\mvc\LogixStaffing
  - task: MSBuild@1
    displayName: Build
    inputs:
      solution: ${{ parameters.codeDirectory }}\${{ parameters.projectSolutionName }}
      msbuildArguments: /p:OutDir="$(Build.ArtifactStagingDirectory)\\" /p:DeployDefaultTarget=WebPublish --warnaserror
  - ${{ if eq(parameters.validate, true) }}:
      - task: SonarQubeAnalyze@7
  - ${{ if eq(parameters.validate, true) }}:
      - task: SonarQubePublish@7
        inputs:
          pollingTimeoutSec: 300
  - task: PublishBuildArtifacts@1
    displayName: Publish build artifacts
    inputs:
      PathtoPublish: $(Build.ArtifactStagingDirectory)/${{ parameters.artifactDirectory }}
      ArtifactName: ${{ parameters.artifactName }}
      publishLocation: Container

```

---

<div class="post-metadata">

**Author:** ![costin.zaharia](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/costin.zaharia/32/62600_2.png) [@costin.zaharia](https://community.sonarsource.com/u/costin.zaharia)\
**Post date:** [October 28, 2024, 9:59am UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/17 "2024-10-28T09:59:26Z")

</div>

Hi James,

Thanks for attaching the logs. I reproduced it in my test environment and logged an issue. You can follow the progress here: [SCAN4NET-152](https://sonarsource.atlassian.net/browse/SCAN4NET-152).

Until a fix is provided, as a workaround, you can try to clone the source code in the Azure DevOps default sources directory ([Build.SourcesDirectory](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#:~:text=Yes-,Build.SourcesDirectory,-The%20local%20path)).

---

<div class="post-metadata">

**Author:** ![gregory.paidis](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregory.paidis/32/39225_2.png) [@gregory.paidis](https://community.sonarsource.com/u/gregory.paidis)\
**Post date:** [November 13, 2024, 1:21pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/20 "2024-11-13T13:21:38Z")

</div>

Hey there!

Can I ask you to try pinning the version of S4NET to the freshly baked hotfix version, by adding this on your inputs:

```auto
dotnetScannerVersion: '9.0.2.104486'

```

If everything works as expected, we will soon go ahead with embedding this version on the AZDO extension (meaning you will be able to remove the pinning).

---

<div class="post-metadata">

**Author:** ![jnesta-lh](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jnesta-lh/32/63355_2.png) [@jnesta-lh](https://community.sonarsource.com/u/jnesta-lh)\
**Post date:** [November 14, 2024, 6:59pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/21 "2024-11-14T18:59:10Z")

</div>

I use Azure DevOps Server, not Azure DevOps Services, so that won’t be possible right?

---

<div class="post-metadata">

**Author:** ![gregory.paidis](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregory.paidis/32/39225_2.png) [@gregory.paidis](https://community.sonarsource.com/u/gregory.paidis)\
**Post date:** [November 19, 2024, 1:15pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/22 "2024-11-19T13:15:27Z")

</div>

Hey James,

Sorry for the delay.  
There shouldn’t be a difference between AZDO Server and AZDO Services.  
Since you are already using the extension, you just need to set the property I mentioned.

---

<div class="post-metadata">

**Author:** ![gregory.paidis](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregory.paidis/32/39225_2.png) [@gregory.paidis](https://community.sonarsource.com/u/gregory.paidis)\
**Post date:** [November 19, 2024, 1:38pm UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/23 "2024-11-19T13:38:59Z")

</div>

To be precise, based on your action:

```auto
   - task: SonarQubePrepare@7
        inputs:
          dotnetScannerVersion: '9.0.2.104486' <---HERE
          SonarQube: SonarQube New
          projectKey: LogixStaffing
          projectName: LogixStaffing
          projectVersion: LogixStaffing-Master
          extraProperties: |
            sonar.verbose=true
            sonar.projectBaseDir=C:\_IT\LogixApplications\apps\mvc\LogixStaffing

```

---

<div class="post-metadata">

**Author:** ![dzfStephen](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@dzfStephen](https://community.sonarsource.com/u/dzfStephen)\
**Post date:** [March 12, 2025, 1:19am UTC](https://community.sonarsource.com/t/sonarqubeprepare-7-azure-devops-task-not-reading-sonar-projectbasedir/128688/24 "2025-03-12T01:19:07Z")

</div>

Hi Gregory. Has this been fixed in new version. I did try the solution you provided, I still got the same error message in V7, it is working for V5 and V6.
