Does Sonarqube supports Xamarin for code quality? - c#

I am working on a Xamarin project. I would like to check code quality with sonarqube. I see there is a support for .net/c# project. I have followed the instruction here for Xamarin.I was able to do the first two steps Begin and Rebuild. When i execute the third step "end"
SonarQube.Scanner.MSBuild.exe end
I am getting below error
mono /Users/apple/Downloads/sonar-scanner-msbuild-2.3.2.573/SonarQube.Scanner.MSBuild.exe end
SonarQube Scanner for MSBuild 2.3.2
Default properties file was found at /Users/apple/Downloads/sonar-scanner-msbuild-2.3.2.573/SonarQube.Analysis.xml
Loading analysis properties from /Users/apple/Downloads/sonar-scanner-msbuild-2.3.2.573/SonarQube.Analysis.xml
Post-processing started.
SONAR_SCANNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
Execution failed. The specified executable does not exist: /Users/apple/Downloads/sonar-scanner-msbuild-2.3.2.573/sonar-scanner-3.0.3.778\bin\sonar-scanner.bat
The SonarQube Scanner did not complete successfully
13:17:17.361 Creating a summary markdown file...
13:17:17.366 Post-processing failed. Exit code: 1

This is currently not supported to use the scanner on non Windows platforms.
There is an open issue for that: https://jira.sonarsource.com/browse/SONARMSBRU-319

Now SonarQube.Scanner.MSBuild.exe has the support for mac, it works.
The sonarqube for MSBuild version 3.0.2 was not supporting Non window OS, now the SonarQube.Scanner.MSBuild.exe 4.0 has the support for mac
Also the sonarC# Plugin has to be > 6.6 to run the analysis on mac os version.
Please check the below link,
https://forums.xamarin.com/discussion/111935/source-code-analysis-for-xamarin-project-with-sonarqube-on-mac/p1?new=1

Related

The SonarQube MSBuild integration failed - SonarQube 7 with Scanner 4.0.2.892 and VS2017

I'm using SonarQube 7.0 and SonarQube Scanner for MSBuild 4.0.2.892 and attempting to follow these instructions to scan my .NET application on Windows (ASP.NET Core). The three commands below are part of the instructions:
C:\SonarQube\Scanner\SonarQube.Scanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"TradingPlatform" /v:"1.0"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" /t:Rebuild
C:\SonarQube\Scanner\SonarQube.Scanner.MSBuild.exe end
However, while pre-processing succeeds on the fist command, and the build completes on the second command, the third command always fails as shown below:
====
SonarQube Scanner for MSBuild 4.0.2
Default properties file was found at C:\SonarQube\Scanner\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube\Scanner\SonarQube.Analysis.xml
Post-processing started.
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 or end steps have not all been launched from the same folder
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
Exit Code 1.
====
Does anyone have any idea why it's failing? Cause 1 can't be the case as I'm building the project in step 2. Cause 2 seems very unlikely (but not impossible) as I'm using MSBuild 15. Cause 3 also can't be the case as I'm running all three commands from the same location
Other possible reasons are:
your build server is executing the builds using Local System account. Try changing the build user to a normal domain or local user.
you are building a .NET Core project that has no ProjectGuid property (the default) and that is not part of a solution. To resolve this you need to do one of these:
Add <ProjectGuid>XXXXX</ProjectGuid> element in the first PropertyGroup in your csproj, where XXXXX is a newly generated Guid.
Add your project to a Visual Studio solution and build the sln file instead of the csproj
If this does not help, add /d:sonar.verbose=true on the begin command of the scanner and save all logs into a file. Zip the logs and the .sonarqube folder from your build workspace and upload them here: https://www.dropbox.com/request/CszJAO1ZNXFVl1gwo5hA

Windows Iot Error : This Process exited with a native exception

Im Working on an app thats build with visual studio 2017 and run on RaspberryPi 3
First, the program was run without problems
After that, I get the following error:
An Issue In The Jamsaz.InjectionWeights.exe process caused it fail to active . this process exited with a native exception
to debug the issue , open project properties , and configure the project to run under a native debugger . more information can be found in the debug pane of the output window ( Debug --> Windows -> Output).
Error Image
After searching the internet
I tested the solutions that were said
But the problem was not resolved
Solutions Made :
build Release and then Build Debug
Clean Solution and Rebuild
Add Package with PowerShell
add-appxpackage C:\Program Files (x86)\MicrosofSDKs\Windows...
Microsoft.VCLibs.x86.Debug.14.00.appx And X64
Change Raspberry Pi OS
Please refer to Getting Started with .NET Native for exhaustive information, and pay attention to that:
Note that there are some known compatibility issues between compiling UWP app projects with the .NET Native tool chain and without it. Refer to the migration guide for more information.
In addition,you can refer to .NET Native General Troubleshooting for troubleshooting potential issues with .NET Native.

Analyze c# code with sonarQube: MSBUILD version problems

I need to analyze various C# files (not a project, just .cs files put under the same directory).
I tried the analysis in 2 different ways and I have errors in each of it. Could someone help solve any of those errors?
1- I tried the analysis like mentioned here
By executing C:\sonar-scanner\bin\sonar-scanner.bat in the root file, I have this error
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalArgumentException: Custom and 3rd party Roslyn analyzers
are only by MSBuild 14. Either use MSBuild 14, or disable the custom/3rd
party Roslyn analyzers in your quality profile.
2- I tired creating a project and analyzing with SonarQube Scanner for MSBuild
But at the end, I have this error that appears
The SonarQube MSBuild integration failed: SonarQube was unable to collect
the required information about your projects.
Possible causes:
1. The project has not been built - the project must be built in between
the begin and end steps
2. An unsupported version of MSBuild has been used to build the project.
Currently MSBuild 14.0 upwards are supported
3. The begin, build or end steps have not all been launched from the
same folder
Generation of the sonar-properties file failed. Unable to complete
SonarQube analysis.
I have Visual Studio 2015,2012,2010,2008 installed. How can I verify that I am using the correct MSBUILD verison (14) because I checked C:\Program Files (x86)\MSBuild and I found the version 14 there.
Is there another issue to handle ?
At the end, I need to be able to do the analysis in both the first and seocnd way.
Thank you in advance!
2- I tired creating a project and analyzing with SonarQube Scanner for MSBuild
According to the document, we need execute following commands from the root folder of the project you want to analyze:
SonarQube.Scanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"Project Name" /v:"1.0"
MSBuild.exe /t:Rebuild
SonarQube.Scanner.MSBuild.exe end
But the command MSBuild.exe is a external command, can not be recognized by Windows in an arbitrary directory, you should add the MSBuild path "C:\Program Files (x86)\MSBuild\14.0\Bin" in to your system environment to make the begin, build or end steps are all launched from the same folder.

Running SonarQube without TFS Build?

I was asked to integrate another project (C#) into SonarQube. We use TFS 2013, SonarQube 5.1.2 with Sonar.MSBuild.Runner 1.0.
The Build process template is old (does not support pre and post Powershell scripts) and it is customized. Visual Studio 2013 is unable to edit the old build process template.
I tried to do just the static code analysis and run the MSBuild.SonarQube.Runner with the start parameter and a second time with the end parameter without doing a build in between (The code coverage does not seem important to them). But then I get the error "No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being build"?
What options do I have to integrate this project into SonarQube?
To use the MSBuild SonarQube Runner from the command line, you have to:
Prepare the environment: MSBuild.SonarQube.Runner.exe begin /k:SQ_project_key /n:SQ_project_name /v:SQ_project_version (pick arbitrary SonarQube project key, name and version)
Run your build: msbuild
Upload analysis results: MSBuild.SonarQube.Runner.exe end
The MSBuild SonarQube Runner integrates with MSBuild and collects informations as it builds your project: You must run the build during the begin and end invocations, or this mandatory information won't be available and the MSBuild SonarQube Runner will fail with the message you reported. The MSBuild integration is compatible with MSBuild versions 4.0, 12 and 14.
Regarding the integration with TFS XAML builds, if you're using a customized one, you'll have to customize it a bit more to integrate the calls to the beginand end commands of the MSBuild SonarQube Runner.
Code Coverage is supported out of the box on TFS 2013 with the default build definition template, you just need to run tests with coverage enabled. If that doesn't work for you, see this link on how to manually pass the code coverage results path property: http://docs.sonarqube.org/x/CoBh

Cannot install emonic c# plugin to Eclipse 3.7.2

I wanted to use the c# inside the Eclipse, but I get that error while trying to install. How to solve that problem.
Below: version of my Eclipse, source(put in the plugin manager) information after calculating dependencies.
Version: 3.7.2
Build id: M20120208-0800
http://emonic.sourceforge.net/updatesite/internap/site.xml
Cannot complete the install because some dependencies are not satisfiable
org.emonic.debugger_feature.feature.group [0.0.2] cannot be installed in this environment because its filter is not applicable.
I'm not an expert, but it appears that the org.emonicdebugger feature is exclusive to Linux:
I was having the same problem. After I unchecked that feature from the download, the installation completed successfully.
I tried to download it four or five times and now I downloaded emonic successful with this link:
http://emonic.sourceforge.net/updatesite/nchc/site.xml (Tainan, Taiwan - Asia).
You have to uncheck the org.emonicdebugger!
I use Eclipse IDE for C/C++ Developers (Version: Mars Release (4.5.0)).
My operating system is Windows 7.

Categories

Resources