I am using Jenkins to run SonarQube for my .Net project(C#).
Visual Studio:2015
MsBuils: 14
Jenkins on Linux (1.624)
SonarServer on Linux (Sonar Version 6.0)
Job Config:
SonarQube Scanner for MsBuilds- Begin analysis
Project key:
Project Name:
Proj Version:
Build a Visual Studio Project or Solution using MSBuild:
MsBuild Version : MsBuild 4.6
MsBuild File: CI.Sln
Command Line Arguments: /p:Configuration=Release /target:Build
SonarQube Scanner for MSBuild- End Analysis
I can generate report for Visual Studio 2015 and post to Sonar Server but when i try to run in Jenkins job its doesn't work.
Error:
ERROR: JAVA_HOME exists but does not point to a valid Java home folder. No "\bin\java.exe" file can be found there.
The SonarQube Scanner did not complete successfully
08:42:40.676 Creating a summary markdown file...
Post-processing failed. Exit code: 1
ERROR: Execution of SonarQube Scanner for MSBuild failed (exit code 1)
I have Windows Server as an agent and out put of Microsoft Windows [Version 6.2.9200]
C:\Windows\System32>echo %JAVA_HOME%
C:\Program Files\Java\jre8
Java Home Variable Path:C:\Program Files\Java\jre8
Please let me know how would I make jenkins job work.
This was a rookie mistake.
This was an issue related to JDK, as i installed JRE but not JDK. I have installed JDK and add the path to Jenkins master and Jenkins job. Ran the job and horraaayyyy, Its working now.
Related
I am new in CI/CD deployment and I want to CI/Cd of ASP.net Project in Jenkins
Note : this project is working fine VS 2017
I am Building abc.sln with command line arrgument /p:OutDir=c:\Samplelocation\;Configuration=release
when I am building the abc.sln then I did not get the Build code as in VS 2017
It gives all directory which is on (Bitbucket) but I need the compile code include .git and .gitignore
I have checked in c:]Samplelocation then it gives me exe file
can anyone please help me on the same.
I'm using VSTS hosted agent VS2017 to run the build, tests, and SonarQube analysis. I'm using the SonarQube extension from the marketplace (https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube). Task version in use is 4 which uses SonarQube Scanner for MSBuild 4.0.2.
The analysis works well, but it doesn't translate the code coverage results to the SonarQube. I can see the Code Coverage analysis in VSTS (build details), but not in SonarQube.
In my understanding, the problem is that VSTS generates a binary file with an extension .codecoverage. SonarQube doesn't know how to handle this file. I'm having trouble converting this to XML format as it seems I have no means to do it.
Has someone used VSTS successfully with SonarQube and got the Code Coverage results to SonarQube as well? How have you set it up?
EDIT 1
SonarQube version that I'm using is: Version 6.7 (build 33306), Community Edition
EDIT 2
The end of analysis actually generates the xml-file, like was stated in the comments below. This is from the logs:
2018-03-06T11:14:56.4189055Z 11:14:56.417 Attempting to locate the
CodeCoverage.exe tool...
2018-03-06T11:14:56.4210147Z 11:14:56.42 Attempting to locate the
CodeCoverage.exe tool using setup configuration...
2018-03-06T11:14:56.4345085Z 11:14:56.433 Code coverage command line tool:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team
Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
2018-03-06T11:14:56.4349101Z 11:14:56.434 Fetching code coverage report
information from TFS...
2018-03-06T11:14:56.4363869Z 11:14:56.435 Attempting to locate a test
results (.trx) file...
2018-03-06T11:14:57.0458245Z 11:14:57.044 Looking for TRX files in:
D:\a\1\TestResults, D:\a\1\s\TestResults
2018-03-06T11:14:57.0462747Z 11:14:57.045 Located a test results file:
D:\a\1\s\TestResults\VssAdministrator_factoryvm-az436_2018-03-
06_11_13_09.trx
2018-03-06T11:14:57.0600587Z 11:14:57.059 One code coverage attachment was
found in the trx file: factoryvm-az436\VssAdministrator_factoryvm-az436
2018-03-06 11_11_34.coverage
2018-03-06T11:14:57.0602504Z 11:14:57.059 Absolute path to coverage file:
D:\a\1\s\TestResults\VssAdministrator_factoryvm-az436_2018-03-
06_11_13_09\In\factoryvm-az436\VssAdministrator_factoryvm-az436 2018-03-06
11_11_34.coverage
2018-03-06T11:14:57.0691948Z 11:14:57.068 Executing file C:\Program Files
(x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynamic Code
Coverage Tools\CodeCoverage.exe
2018-03-06T11:14:57.0692731Z Args: analyze
/output:D:\a\1\s\TestResults\VssAdministrator_factoryvm-az436_2018-03-
06_11_13_09\In\factoryvm-az436\VssAdministrator_factoryvm-az436 2018-03-06
11_11_34.coveragexml D:\a\1\s\TestResults\VssAdministrator_factoryvm-
az436_2018-03-06_11_13_09\In\factoryvm-az436\VssAdministrator_factoryvm-
az436 2018-03-06 11_11_34.coverage
2018-03-06T11:14:57.0694963Z Working directory:
D:\a\1\s\TestResults\VssAdministrator_factoryvm-az436_2018-03-
06_11_13_09\In\factoryvm-az436
2018-03-06T11:14:57.0695792Z Timeout (ms):60000
2018-03-06T11:14:57.0699007Z Process id: 3540
2018-03-06T11:14:58.7847582Z 11:14:58.783 Process returned exit code 0
2018-03-06T11:14:58.7858908Z 11:14:58.784 Updating project info files with
code coverage information...
The VSTS extension should automatically import the coverage results, but there is currently a regression that will be fixed (hopefully) soon: SONARMSBRU-339
Meanwhile, there is a workaround explained in the VSTS extension documentation in "Analysing a .NET solution": in the Additional Properties text area, add the following property:
sonar.cs.vscoveragexml.reportsPaths=**/*.coveragexml
I was unable to see the 'coveragexml' file even though I set 'sonar.verbose=true', 'system.debug=true'. Although, I found another way that works just fine, i.e. converting '.coverage' files into '.coveragexml' with PowerShell script:
Get-ChildItem -Path $(Agent.TempDirectory) -Include "*.coverage" -File -Recurse | % {
$outfile = "$([System.IO.Path]::GetFileNameWithoutExtension($_.FullName)).coveragexml"
$output = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($_.FullName), $outfile)
"Analyse '$($_.Name)' with output '$outfile'..."
.$env:USERPROFILE\.nuget\packages\microsoft.codecoverage\15.8.0\build\netstandard1.0\CodeCoverage\CodeCoverage.exe analyze /output:$output $_.FullName
}
To make it work, make sure you have 'Inline PowerShell' task installed for the Marketplace and place it before 'Run Code Analysis' step in your build pipeline.
For those who use a self-hosted agent, you can also install Visual Studio Test Agent 2019.
It contains a CodeCoverage.exe file that the SonarQubeAnalyze#4 Azure DevOps task will find. SonarQube will be able to convert .coverage file into .coveragexml, according to this SonarQube documentation webpage.
Visual Studio Test Agent seems to be free. No need to pay for Visual Studio Enterprise.
I have implemented the continuous integration of xamarin.form project with TFS. I am using "Hosted VS2017" as agent queue. Since few days I am facing one issue, my code builds successfully on my machine but not in TFS. Nuget restores successfully but "Build Xamarin.Android Project xyz/xyz.Android/xyz.Android.csproj" fails and it shows me below error
COMPILETODALVIK (0, 0) COMPILETODALVIK(0,0): Error :
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2028,3):
Error XA5213: java.lang.OutOfMemoryError. Consider increasing the
value of $(JavaMaximumHeapSize). Java ran out of memory while
executing 'java.exe -jar "C:\Program Files
(x86)\Android\android-sdk\build-tools\26.0.2\lib\dx.jar" --no-strict
--dex --output=obj\Release\android\bin obj\Release\android\bin\classes "C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.0\mono.android.jar"
obj\Release__library_projects__\FormsViewGroup\library_project_imports\formsviewgroup.jar
obj\Release__library_projects__\HockeySDK.AndroidBindings\library_project_imports\bin\classes.jar
obj\Release__library_projects__\Xamarin.Android.Support.Animated.Vector.Drawable\library_project_imports\bin\classes.jar
obj\Release__library_projects__\Xamarin.Android.Support.Compat\library_project_imports\bin\classes.jar
obj\Relea...
Process 'msbuild.exe' exited with code '1'.
Error XA5213: java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize). Java ran out of memory while executing 'java.exe -jar
I increase the heap size to 1G, 2G but none of the solution work for me.
Its properly working on my machine but not working in TFS
Usually, When this kind of error comes into our visual studio it may be solved by rebuilding the project. How to rebuild the project into TFS?
I have tried different possible solutions but can't able to resolve the issue
Please try below items to narrow down the issue:
Enable clean source option : Set Clean to True in the first
Get Srouces step.
Also enable the Clean option in build step.
Select the latest JDK version (JDK 8), and select X64 as the JDK
Architecture.
Reference : Xamarin Android Out of Memory Build Failure to set
Allow Large Heap
Then try it again.
If that still not work, you can try to deploy a private agent on Windows, then install/set SDK/components on the private anent machine same as your Develop machine which worked locally. Then select the private agent to build.
Use JDK8 and x64 in VSTS build. Only this combination works as of now. JDK9 x64 or JDK x86 doesn't work....
i am using visual studio 2015 and tfs for build the project,
I started the build but got stuck with the error described below,
2016-03-17T09:38:15.2135195Z ##[error]No ProjectInfo.xml files were found. Possible causes:
2016-03-17T09:38:15.2135195Z ##[error]1. The project has not been built - the end step was called right after the begin step, without a build step in between
2016-03-17T09:38:15.2135195Z ##[error]2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
2016-03-17T09:38:15.2135195Z ##[error]3. The build step has been launched from a different working folder
2016-03-17T09:38:15.2135195Z Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
2016-03-17T09:38:15.2135195Z 15:08:15.15 Creating a summary markdown file...
2016-03-17T09:38:15.2135195Z ##[error]Post-processing failed. Exit code: 1
2016-03-17T09:38:15.2135195Z ##[error]Unexpected exit code received from batch file: 1
Can any one help me in this?
Assuming you are using TFS2015 vNext build, and you are trying to add build tasks below to execute a SonarQube analysis:
· SonarQube for MSBuild – Begin Analysis
· SonarQube for MSBuild – End Analysis
From your error log, you need to make sure the End Analysis task should be used to create a step that is executed after the “Visual Studio Build” task step. Review blog Build Tasks for SonarQube Analysis get more information of how to use SonarQube analysis tasks.
What I thought would be simple is not. All I am trying to do is get MSBuild to copy website files to another server after my build.
In my Build definition Under Process --> Advance --> MSBuild Arguments I put
/p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile
It builds fine but it never copies files to destination
BUT when I run this command locally, IT WORKS!!!!!
msbuild /p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile
I have VS 2012 installed in Build Server so I think all the necessary files are there.
What is the problem?
UPDATE 1
Output in build log file
Run MSBuild for Project
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /nologo /noconsolelogger "C:\Builds\1\MyProject\MyProject\src\MyProject.sln" /nr:False /fl /flp:"logfile=C:\Builds\1\MyProject\MyProject\src\MyProject.log;encoding=Unicode;verbosity=detailed" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile /p:VisualStudioVersion=11.0 /m /p:OutDir="C:\Builds\1\MyProject\MyProject\bin\\" /p:RunCodeAnalysis="False" /p:VCBuildOverride="C:\Builds\1\MyProject\MyProject\src\MyProject.sln.vsprops" /dl:WorkflowCentralLogger,"E:\Microsoft Team Foundation Server 11.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;BuildUri=vstfs:///Build/Build/64;InformationNodeId=20178;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;TFSUrl=http://abc-tfs-p:8080/tfs/defaultcollection;"*WorkflowForwardingLogger,"E:\Microsoft Team Foundation Server 11.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;"
REPRODUCTION STEPS
Created new website project
Made sure it worked on local machine
using development server
Checked code in TFS
Created a build definition using all the default settings Under the Process -->
Advance --> MSBuild Arguments I put
/p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile
The publish profile copies the changeset to a remote server.
Installing the Web Tools 2012.2 update on the build server fixed this issue for me after I read this post and Scott Gu's Blog. I don't have Visual Studio installed on the server but installing the update got my DeployOnBuild working. I hope that helps.