I want to install sonarqube. And I want to see bug etc in my C# project.
But I didn't get results. Can you help me with why I can't?
Install download sonarqube.
Install ms build sonar-scanner.
I write sonar.project-properties and scanner into the bin file.
sonar.projectKey= //projectkey
sonar.projectName= //this same projectkey
sonar.projectVersion=1.0
This project is put bin file.
I added the scanner to path path.
Enter localhost
Create project and enter project key and name (same as name and key in txt)
But this project is empty even though My project is passed.
The code appears when I enter the code section but fields like bug vurnelabilities don't appear.Bugs,vulnerabilities,code smells show zero but passed solution.I know it's the error so I can't 0
I want to appear with the error of my project code there bugs appear areas etc. But "this project is empty" looks like "passed "
Shouldn't code errors appear here?Why can't I see?
Are you aware of SonarLint for Visual Studio
To scan your C# code and push the results to SonarQube you need to use the SonarScanner for MSBuild, not the SonarScanner.
SonarLint is a Visual Studio extension that runs the SonarC# and SonarVB.Net analyzers in the IDE. It does not push the results to SonarQube.
SonarLint is available for VS2015 Update 3 and VS2017.
Very common problem for many users, that SonarQube Code Analysis fails with an error:
[10:06:05]No ProjectInfo.xml files were found. Possible causes:
[10:06:05]1. The project has not been built - the end step was called right
after the begin step, without a build step in between
[10:06:05]2. An unsupported version of MSBuild has been used to build the
project. Currently MSBuild 12.0 upwards are supported
[10:06:05]3. The build step has been launched from a different working folder
[10:06:05]Post-processing failed. Exit code: 1
[10:06:05]Process exited with code 1
A lot of references say that fix is to use full path for MSBuild.exe, but yes, I use full path, but also I use MSBuild 15.0 version with newest C# version, older MSBuild just fails for new C# features in code.
However I can't get rid of this error and I have no idea what can be done about it, so maybe any of you guys have already met this problem and could help me?
EDITED
I am pretty sure that none of these steps should be the reason for the fail, the second one only the closest one, because my build steps are
Team City build steps look like the following.
Step XX:
cd %projectDirectory%
"C:\sonarqube-5.3\bin\MSBuild.SonarQube.Runner\MSBuild.SonarQube.Runner.exe" begin ... params
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" "MyProject.sln" /t:Clean;Rebuild
Step XY:
...
Step XZ: (the last)
cd %projectDirectory%
"C:\sonarqube-5.3\bin\MSBuild.SonarQube.Runner\MSBuild.SonarQube.Runner.exe" end
For me it looks very simple and easy to understand, but still I got that error and I have no idea why, the error is thrown in the last step (XZ).
You need to upgrade to a newer version of the Scanner for MSBuild. I'd suggest upgrading to the newest available version (v4.2 at the time of writing).
The scanner copies a targets file under the following location for each supported version of MBuild: %localappdata%\Microsoft\MSBuild[MSBuild version]\Microsoft.Common.targets\ImportBefore.
From the look of the log output you are using an version of the Scanner for MSBuild that pre-dates the release of MSBuild 15, so the file won't be copied to the MSBuild15-specific location. This will lead to the "no ProjectInfo.xml files were found" state.
It would be better if the warning message in the scanner log explicitly listed the range of MSBuild versions that were supported e.g. "This version of the Scanner supports MSBuild v12.0 to v14.0". I've created issue #502 to track this.
Recently, I've been running into a perplexing issue regarding Sonar that I can't seem to figure out. I couldn't really find anything on this specific issue online, so I figured I'd reach out and see if anyone has experienced this as well.
I am using the following:
Sonar 6.0
TFS 2017 Update 1
SonarQube VSTS Extension 2.1.1
Build server with Visual Studio 2017
When I am performing Sonar analysis after a build and after tests complete, it is detecting both the resulting trx file and coverage file.
But once the analysis is done, it only reports code coverage. It does not report the unit test count.
Originally, I was using the following arguments in the "Additional Settings" in the Sonar Begin Analysis step to specifically point it to the trx:
/d:sonar.exclusions=**Scripts**,**Content** /d:sonar.cs.vscoveragexml.reportsPaths="$(Common.TestResultsDirectory)\*.coverage" /d:sonar.cs.vstest.reportsPaths="$(Common.TestResultsDirectory)\*.trx"
But I just tried removing all those arguments as I was told by a sonar rep in the past that you want to specify parameters from the site instead of by command line. When I removed my parameters, nothing changed (which I guess is to be expected). It still was able to find the trx file and still did not report unit test count.
I would try adding the vstest report path in the UI, but the issue is the path and file name are dynamically generated. The path depends on what build server/vsts agent the build is sent to, and the trx file name is generated based on date-time, and as far as I could find, there is no way to force the trx file to have a specific name.
I also checked the trx file to make sure I could open it and it reported test data.
Essentially, as far as I can tell, it should be reporting the unit test count. It did in the past but seems to have been not working as of recently. I'm not sure if this maybe was fixed in a newer version of Sonar? Unfortunately, I can't upgrade because dashboards were removed in newer versions of Sonar, and the organization I work for uses them. Has anyone experienced this issue before, and if so, were you able to fix it? Let me know if you need any additional information!
Try to use /d:sonar.cs.vstest.reportsPaths=..\**\TestResults\**\*.trx instead (Additional Settings).
On the other hand, there is SonarQube 2.1.2 aviable.
My result: https://1drv.ms/i/s!AresBGZVYryjhSpb9taJWFht7YB9
To run a simple program I was using 'csc' in command prompt and it was working fine. Please advice on below both issues
a) But after installing IIS in my laptop now it is not working.
b) And even if I try with Visual Studio Development Server for a web application it is showing error 500. Don't know if both issues are inter-related.
Below are the few steps which I did:
Installation of IIS
c:\Windows\Microsoft .Net\v4.0\csc.exe, which showing below error::
Warning: No source file specified
error CS1562: Outputs without source must have the /out option specified
Thanks!
csc need something to go on as can be seen from the information that microsoft privides on the usage of csc:
https://msdn.microsoft.com/en-us/library/78f4aasd.aspx
So it is still working fine you need to feed the compiler with input. It needs your cs files as input and perhaps even some other parameters to specify the output filename and such.
csc File.cs : compiles the File.cs source file and creates a File.exe
I create a new project, click compile, and get this error:
Build Failed. See the build log for details.
In the build log there is only this:
Building: FirstProgram (Debug|x86)
---------------------- Done ----------------------
Build failed.
Build: 1 error, 0 warnings
Here is what I see:
What causes this error and how do I fix it?
Lots of times dealing with this error. I just closed and reopened. It happens every time I add a solution and then delete it. I think Xamarin Ide is not a really good Ide, not in Mac at least.
In my case, i did`t Indy (or higher) License.
When i started trial period, the problem was solved.
I got the same error when trying to build. Without having noticed I had been logged out of my account, which caused the error. Curious that I wasn't prompted to relog or given information that I wasn't logged in.
Though this is an old post, maybe this could help someone.
In my case, using Xamarin Studio 6.1.4 (build 1), I unchecked
the 'Use MsBuild engine ...' check box under Project Options > Build > General and
the problem disappeared.
I searched for solution online for similar problem, but none solved my problem, then I tried this:
Tools >>> Options >>> Projects and Solutions >>> Build and Run
Then I changed MSBuild output and MSBuild log to Detailed.
Rebuild and the error message will show.
cd into the project path, and hit msbuild on it.
You will then see the error details in the console STDOUT.
I had the same problem after upgrading Xamarin, and in my case it happened even for a x86/desktop Console Application. Turned out to be because I didn't have 4.5.1, which was required by the newer version (I had only 4.5 I think).
I found this entry in the log:
Unregistered TargetFramework '.NETFramework,Version=v4.5.1' is being requested from SystemAssemblyService, returning empty TargetFramework
After googing this error I found https://stackoverflow.com/a/38102386/492336, and the solution was to download .NET 4.5.1 and it worked after that!
I just ran into the same problem using Visual Studio Community for Mac. The system was out of disk space. Freeing up some disk allowed a build to complete successfully.
Try the following options from Build menu:
Clean All
Rebuild All
Then build it again.
If won't help, check your log files for details by going to Help menu and Open Log Directory.
For example by dragging & dropping the log folder into newly opened Terminal window, and run:
tail -f *.log
then run the build again and check the reported logs. Hit Control-C on Terminal when finished.
For better visibility, run:
tail -f *.log | grep -C5 -i error
You can also try to clear cache folder of VisualStudio, e.g.:
$ lsof -p $(pgrep VisualStudio)
$ rm -fr ~/Library/Caches/com.microsoft.visual-studio
I downloaded and installed the packages shown below in the order listed:
JDK 1.6: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html Please choose the jdk-6u31-windows-i586.exe installer from the list above.
Android SDK: http://dl.google.com/android/installer_r20-windows.exe After the main installer is done, please open the SDK Manager and install the following platform APIs: 7,8,10,12,14
Mono for Android SDK: http://download.xamarin.com/MonoforAndroid/Windows/mono-android-4.4.55.104956787.msi
Reboot Xamarin.
Try building your project from the Powershell command line.
dotnet build
Then, build errors will appear in the command line output.
I encountered this issue today in Visual Studio for Mac 2022 with a Xamarin Forms 5 project. In my case, going to the Solution properties, under Build → General, and unchecking "Build with MSBuild on Mono" worked.
(This might be similar in spirit as #JackGriffin's answer, but it seems to be a solution property rather than a project property.)