JetBrains / TeamCity.SonarQubePlugin

A plugin for TeamCity server allowing you to configure and run SonarQube analysis from the CI
Apache License 2.0
53 stars 31 forks source link

Duplicate ProjectGuid Warning with Sonar MSbuild runner. #60

Open Lexus-3141 opened 5 years ago

Lexus-3141 commented 5 years ago

Hi. I have thouble with runner hook. Plugin catch teamcity temporary file *.csproj.teamcity [Step 12/12] WARNING: Duplicate ProjectGuid: "f8cc0961-f946-467c-a3d0-2251ab2852dc". The project will not be analyzed by SonarQube. Project file: "C:\TeamCity\buildAgent\work\a768aae0f58b116\repo\testconsole\TestConsole.csproj.teamcity" [14:07:11][Step 12/12] WARNING: Duplicate ProjectGuid: "f8cc0961-f946-467c-a3d0-2251ab2852dc". The project will not be analyzed by SonarQube. Project file: "C:\TeamCity\buildAgent\work\a768aae0f58b116\repo\TestConsole\TestConsole.csproj" What's wrong? How can do I avoid this?

Teamcity ver: Professional 2018.2.3 (build 61544) SonarQube plugin ver: P2017.1-22

Linfar commented 5 years ago

Please check this ticket on SonarSource bugtracker - there's an explanation of this message

Lexus-3141 commented 5 years ago

Unfortunately, it's miss. I'm understand abount GUIDs in sln. But we have deferent trouble here. 'TestConsole.csproj.teamcity' - not a project's file. I mean it's temporary teamcity engine file. I've checked it exists short time only and plugin catchs it as real project file.

Linfar commented 5 years ago

Then you should filter out this path. There's sonar.exclusions parameter which can be added to the runner but as far as I see (eg here) it's not working with Scanner for MSBuild. There's one workaround mentioned in that post. Unfortunately I'm not in common with .Net and cannot check it myself but will try to find more information.

Lexus-3141 commented 5 years ago

Hmm, may will you filter it out programmaticaly? Because i mean it's wrong plugin behavior. It reacts to teamcity service file.

Linfar commented 5 years ago

What do you mean by teamcity service file? Does everything work when running the same procedure is run from commandline?

Lexus-3141 commented 5 years ago

I guess *.csproj.teamcity files creates by teamcity wrapper for short time and it is outside the users scope. The file has a correlated to real project name. In my case the bug happens for one small project only. Can do we investigate this? But I know about the files nothing.

Linfar commented 5 years ago

I will ask my colleges who are responsible for .Net support in TeamCity about these files. If possible I will add some filtering by default.

Meanwhile you can try to add some manual exclusion to check workaround.

Lexus-3141 commented 5 years ago

Upd: I've fixed this used teamcity build configutation parameter teamcity.msbuild.generateWrappingScript=false It's mentioned here: https://stackoverflow.com/questions/4211683/why-does-teamcity-add-csproj-teamcity-patch-to-web-app-package-files

But have one more trouble. Windows has case-insensitive file paths, but the plugin is case-sensitive if define lowercase confiruration param for MSBuild step and repo has case-different file path.

[20:36:33][Step 12/12] WARNING: Duplicate ProjectGuid: "f8cc0961-f946-467c-a3d0-2251ab2852dc". The project will not be analyzed by SonarQube. Project file: "C:\TeamCity\buildAgent\work\35a6f481e3fa4b56\repo\testconsole\TestConsole.csproj" [20:36:33][Step 12/12] WARNING: Duplicate ProjectGuid: "f8cc0961-f946-467c-a3d0-2251ab2852dc". The project will not be analyzed by SonarQube. Project file: "C:\TeamCity\buildAgent\work\35a6f481e3fa4b56\repo\TestConsole\TestConsole.csproj"

It's one and the same file indeed.

Linfar commented 5 years ago

Which parameter caused this?

Lexus-3141 commented 5 years ago

We have the template containing msbuild runner step. Step parameter "Build file path:" is defined as a %configuration parameter% for users.

Linfar commented 5 years ago

This seems to be 2 bugs - one in TC MSBuild Runner generating somewhere a project reference in different casing and SonarQube MSBuild Scanner bug not filtering same paths on Windows. I need some time to investigate this.