Created sonar cloud c# project in sonarcloud.io using devops to run the below command
dotnet sonarscanner begin
/k:“$SONAR_PROJECT_KEY”
/n:“$SONAR_PROJECT_KEY”
/o:“$SONAR_OGRANIZAION” \ etc etc command
Project is created with SONAR_PROJECT_KEY parameter value name
But when I try to rename the sonarcloud project in sonarcloud.io with below syntax , did not rename previously created project name with SONAR_PROJECT_NAME parameter value. Could you please help
dotnet sonarscanner begin
/k:“$SONAR_PROJECT_KEY”
/n:“$SONAR_PROJECT_NAME”
/o:“$SONAR_ORGANIZATION” \
Trying to rename existing project name with SONAR_PROJECT_NAME parameter value but existing project name is not renamed to the value of SONAR_PROJECT_NAME parameter
Can you check the scanner context (Administration → Background Tasks → [row dots menu] → Show SonarScanner Context) to see what sonar.projectName value was included in the analysis?
project name I am expecting is swo-digital-common but found softwareone-pc_swo-digital-common value. This value is actual sonar project key value which I am not expecting to be here
So it looks like a problem setting your variable. That’s going to be somewhere in your pipeline before analysis.
Alternately, it’s possible that analysis is automatically defaulting the project name to the value of sonar.projectKey because no sonar.projectName is provided. And that would also be about the values that get set up before / go into analysis.
But while searching for the project name swo-digital-common - I am not able to see the entry with swo-digital-common only instead found with project key - not correct - expected should be swo-digital-common should be be found instead of project key mentioned in below screenshot
From the logs, I can see that you are doing the analysis on a branch, and that is the reason why the renaming did not work. You have to do an analysis against your main branch to be able to rename the project.
I was on vacation. Apologies for the late reply. Could you please let me know the reasons why renaming does not work on other branch than on main branch ?