No ProjectInfo.xml files were found Sonar scan - tfs

I am trying to configure my visual studio project to send some scan data to SonarQube server using TFS 2015 build (vnext)
I get this error in the Sonar end task.
##[error]No ProjectInfo.xml files were found. Possible causes:
##[error]1. The project has not been built
The end step was called right after the begin step, without a build step in between an unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported.
We use MSBuild 14.0 in the server. it is a C++ project (VCXPROJ project File)

Related

SonarScanner giving 'MsBuild.exe' is not recognized as an internal or external command on TFS 2018

I'm adding SonarQube to existing TFS 2018 builds. I was following the directions for downloading Community Edition 7.4 located here https://docs.sonarqube.org/display/SCAN/Install+the+SonarScanner+for+MSBuild.
Going through the steps of the Quick Installation Guide https://docs.sonarqube.org/latest/setup/get-started-2-minutes/
I get to the part where I’m asked to “Execute the Scanner for MSBuild from your computer” using the below commands:
SonarScanner.MSBuild.exe begin /k:"{key}" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="{key}"
MsBuild.exe /t:Rebuild
SonarScanner.MSBuild.exe end /d:sonar.login="{key}"
When I run the first command it succeeds
C:\sonar-scanner-msbuild-4.4.2.1543-net46> SonarScanner.MSBuild.exe begin /k:"{key}" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="{key}"
SonarScanner for MSBuild 4.4.2
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\sonar-scanner-msbuild-4.4.2.1543-net46\SonarQube.Analysis.xml
Loading analysis properties from C:\sonar-scanner-msbuild-4.4.2.1543-net46\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
13:32:09.468 Updating build integration targets...
13:32:09.5 Fetching analysis configuration settings...
13:32:10.173 Provisioning analyzer assemblies for cs...
13:32:10.173 Installing required Roslyn analyzers...
13:32:10.579 Provisioning analyzer assemblies for vbnet...
13:32:10.579 Installing required Roslyn analyzers...
13:32:10.735 Pre-processing succeeded.
However when I run the second command "MsBuild.exe /t:Rebuild" It fails with the following error:
C:\Program Files (x86)>MsBuild.exe /t:Rebuild
'MsBuild.exe' is not recognized as an internal or external command,
operable program or batch file.
I confirmed I added/updated environmental variables %PATH%, MsBuild exists, I’m wondering if there’s an additional step not noted in the instructions for .NET 4.5 framework? Has anyone come across this error for .NET using TFS builds or has any thoughts?
Try to enter exact path of msbuild e.g. for VS2017 Professional command should be:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\"MsBuild.exe /t:Rebuild

SonarQube Scanner for MS build with Jenkins failed in the end step

These are the final logs:
The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:
The project has not been built - the project must be built in between the begin and end steps
An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0 upwards are supported
The begin, build and end steps have not all been launched from the same folder
None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.

MSBuild DeploymentModel unrecognised error in deploying SSIS package

I created a PowerShell script to automate deployment for SSIS projects and used it in a custom TFS task. Within this task I used a msbuild step to build the SSIS project which keeps failing with this error:
Error MSB4067: The element DeploymentModel beneath element Project
is unrecognized.
I built the SSIS projects in visual studio 2015 just fine. I have tried msbuild version 12.0 and 15.0 and they both have the same error.
Thank you
When you build your SSIS projects via VS, actually is calling /Build (devenv.exe), not directly using MSBuild.
There is no build-in task that supports building via devenv.exe.Still in the backlog. More details please refer: "Visual Studio Build" build step that actually invokes devenv.com instead of msbuild?
As a workaround, you could try to use 3-party extension task SSIS Build & Deploy for now.

No ProjectInfo.xml files were found .TFS build with sonar end task

I am trying to configure my visual studio project to send some analysis data to SonarQube server using TFS 2015 build (vnext)
I get this error in the Sonar end task.
##[error]No ProjectInfo.xml files were found. Possible causes:
##[error]1. The project has not been built - the end step was called right after the begin step, without a build step in between
An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
We use MSBuild 14.0 in the server.
The SonarQube Scanner for MSBuild requires your project to be built
with MSBuild 14.0. We recommend installing Visual Studio 2015 on the
analysis machine in order to benefit from the integration and features
provided with the Visual Studio ecosystem (VSTest, MSTest unit tests,
etc.).
Suggest you to also install VS2015 on your build server, and since you are using MSbuild 14.0, double check if you are using the old task with deprecated in front which used for MSbuild 12.0. SonarQube Scanner for MSBuild released with static analysis which could executed during the build on MSbuild 14.0.
The support of MSBuild 12 by the SonarQube Scanner for MSBuild is
deprecated and will be removed in a future release.
Source: Compatibility with Visual Studio and MSBuild
Please download and use the latest version of the SonarQube Scanner for MSBuild in marketplace and try again. The recent documentation is available from Analyzing with SonarQube Extension for VSTS/TFS, you could also take a look at this tutorial.

TFS 2010 issues building C#6.0 code with MS Build 14

We have TFS 2010 running happily on a dedicated build server.
I have installed Microsoft Build Tools 2015, which includes MS Build 14 successfully on the build machine, but not Visual Studio 2015.
I've created a custom template which alters the "ToolsPath" property of the "Run MSBuild" activity to "C:\Program Files (x86)\MSBuild\14.0\Bin".
The build runs, but fails on this particular error:
(CoreCompile target) ->
CSC : error CS1566: Error reading resource 'ProjectName.exe.licenses' --
'Could not find file 'C:\develop\Sources\ProjectName\obj\x86\Release\ProjectName.exe.licenses'.' [C:\develop\Sources\ProjectName\ProjectName.csproj]
The same project builds fine using Visual Studio 2015 running from another machine.
It makes no difference whether the TFS build definition includes these MS Build arguments or not:
/tv:14.0 /p:VisualStudioVersion=14.0
Does anybody have a success story of using a TFS 2010 build agent to successfully build a C#6.0 project?
I solved this in the end by installing Visual Studio 2015!
The /tv:14.0 /p:VisualStudioVersion=14.0 argument may don't work for MSBuild Tools.
You should customize the tfs build process template to set ToolPath of the Run MSBuild for Project to target to MSBuild14; and set ToolVersion to "14.0".
Check this link for the detailed information:BuildActivity ignores ToolsVersion

Resources