# \[Question\] Cannot scan dotnet core project

**URL:** <https://community.sonarsource.com/t/question-cannot-scan-dotnet-core-project/23528>\
**Category:** SonarQube Server / Community Build\
**Tags:** sonarqube, dotnet\
**Created:** [April 23, 2020, 6:47am UTC](https://community.sonarsource.com/t/question-cannot-scan-dotnet-core-project/23528 "2020-04-23T06:47:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuanna2704](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tuanna2704](https://community.sonarsource.com/u/tuanna2704)\
**Post date:** [April 23, 2020, 6:47am UTC](https://community.sonarsource.com/t/question-cannot-scan-dotnet-core-project/23528/1 "2020-04-23T06:47:28Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):

- I am using dotnet core sdk 3.1 on macOS
- I am trying follow the step in this link([https://docs.sonarqube.org/pages/viewpage.action?pageId=6954799](https://docs.sonarqube.org/pages/viewpage.action?pageId=6954799)) to scan dotnet project.

`dotnet tool install --global dotnet-sonarscanner`  
`dotnet sonarscanner begin /k:` `"project-key"`  
`dotnet build <path to solution.sln>`  
`dotnet sonarscanner end`  
but when I exec command `dotnet sonarscanner begin /k:` `"project-key"`  
Here is the result:

> Could not execute because the specified command or file was not found.  
> Possible reasons for this include:
> 
> - You misspelled a built-in dotnet command.
> - You intended to execute a .NET Core program, but dotnet-sonarscanner does not exist.
> - You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

Does any khow why? Thanks!

---

<div class="post-metadata">

**Author:** ![OlivierK](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/olivierk/32/11116_2.png) [@OlivierK](https://community.sonarsource.com/u/OlivierK)\
**Post date:** [April 23, 2020, 7:07am UTC](https://community.sonarsource.com/t/question-cannot-scan-dotnet-core-project/23528/2 "2020-04-23T07:07:48Z")

</div>

Hello @tuanna2704,

Difficult to be sure but that looks like that:

- Either your dotnet-sonarscanner installation failed
- Or you installed a too old version of the dotnet-sonarscanner

Can you try: `dotnet tool list -g` to check all the installed tools and verify that the `dotnet-sonarscanner` is installed, **in version 4.8**

If that’s not the case:

- If not installed, run install again `dotnet tool install --global dotnet-sonarscanner` to install and check any possible installation error message
- If not version 4.8, upgrade with `dotnet tool update --global dotnet-sonarscanner`

Then let me know where you are.

Bye

---

<div class="post-metadata">

**Author:** ![tuanna2704](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tuanna2704](https://community.sonarsource.com/u/tuanna2704)\
**Post date:** [April 23, 2020, 7:45am UTC](https://community.sonarsource.com/t/question-cannot-scan-dotnet-core-project/23528/3 "2020-04-23T07:45:35Z")

</div>

Hi [Olivier Korach](https://community.sonarsource.com/u/OlivierK). Its haven’t work. Thanks for your supporting. Below is my screen. Maybe it can help.

 ![Screen Shot 2020-04-23 at 2.42.22 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/9/9b38524425f83cd7a8e4ff8d7b04fa3cd9829a4d.png)

---

<div class="post-metadata">

**Author:** ![OlivierK](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/olivierk/32/11116_2.png) [@OlivierK](https://community.sonarsource.com/u/OlivierK)\
**Post date:** [May 29, 2020, 7:22am UTC](https://community.sonarsource.com/t/question-cannot-scan-dotnet-core-project/23528/5 "2020-05-29T07:22:34Z")

</div>

Sorry for the delay.

You don’t run the scanner with the right command. Please check [documentation](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/#header-3)  
This should be:  
`dotnet sonarscanner begin /k:<myProjectKey>`  
and not  
`dotnet dotnet-sonarscanner begin /k:<myProjectKey>`

Once you fixed your cmd line you may have another problem: There’s a **dotnet** strange behaviour (a bug ?) that causes just installed tools to not be immediately accessible to run.  
There are quite some posts on the internet about that, with a variety of solutions.  
See [https://github.com/dotnet/sdk/issues/8999](https://github.com/dotnet/sdk/issues/8999) and [https://github.com/dotnet/cli/issues/8369](https://github.com/dotnet/cli/issues/8369)  
You may try the recipes given there.

I could also reproduce a similar problem in a docker container.  
I had to set the `$PATH` env variable before the scanner could be used

```
dotnet tool install dotnet-sonarscanner --global
export PATH="$PATH:/root/.dotnet/tools"
dotnet sonarscanner begin /k:<myProjectKey>

```

Let me know.

---

<div class="post-metadata">

**Author:** ![Andrei\_Epure](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andrei_epure/32/77402_2.png) [@Andrei\_Epure](https://community.sonarsource.com/u/Andrei_Epure)\
**Post date:** [April 27, 2021, 11:05am UTC](https://community.sonarsource.com/t/question-cannot-scan-dotnet-core-project/23528/10 "2021-04-27T11:05:30Z")

</div>

Split this topic on April 27, 2021, 11:05am UTC

A post was split to a new topic: [“Could not find ‘java’ executable in JAVA\_HOME or PATH.” when scanning with Scanner for NET](https://community.sonarsource.com/t/could-not-find-java-executable-in-java-home-or-path-when-scanning-with-scanner-for-net/42331)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/78532_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [May 4, 2021, 11:06am UTC](https://community.sonarsource.com/t/question-cannot-scan-dotnet-core-project/23528/11 "2021-05-04T11:06:25Z")

</div>

Closed on May 4, 2021, 11:06am UTC

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