How to run Sonar Scanner on a Visual Studio 2019 solution? - msbuild

We started to use VS2019 and all the new things that comes with. We noticed that the build manager doesn't work anymore:
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 and 15.0 are supported
3. The begin, build and end steps have not all been launched from the same folder
4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
I checked, but I thing I've the latest version of SonarScanner installed. I'm kind of stuck, how to execute all our tests if we use some things of the MSBUILD V16(2019) compiler, but sonar cube doesn't seems to be compatible?
Is there a workaround?
Thanks

Related

MsBuild failing for .Net Standard project with error "Package System.Security.Cryptography.ProtectedData, version x.x.x was not found"

Project Setup : Mixed framework solution
.Net Framework 4.6.2 projects in solution : 15
.Net Standard 2.0 projects in solution - 1
Development Machine
Visual Studio 2017(15.7.4) : Builds without any errors
Build Server
TeamCity Version 2017.1.3
Build Steps
Nuget Restore(3.4.4)
dotnet Restore
MSBuild( Build Tools 2017), Tools Version 15.0
Build fails with following error in the .net standard 2.0 project : [ResolvePackageAssets] C:\Program Files\dotnet\sdk\2.1.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198, 5): Package System.Security.Cryptography.ProtectedData, version 4.4.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
What's interesting is I can't find reference or use of System.Security.Cryptography.ProtectedData anywhere in the project. Any help is greatly appreciated.
P.S - Can't use dotnet build, as the solution needs building of licenses.licx files, and the component which builds it (Microsoft.Build.Tasks.LC) is not ported to .Net Core. The suggestion from various posts was to use MsBuild.exe

SonarLint version included with Sonarqube C# plugin

According to this site the sonarlint or sonar scanner should be version 2 if you are using the C# plugin 4.5 or higher (i am using v5)
But when I look at the files included the sonarlint version is v1.10.
Is this correct or is the incorrect version currently bundled with the C# plugin.
My problem is that After I installed VS2015 SP2 on the build server SonarQube stopped logging Issues, and with my debugging this is one of the last items on the list of possible causes.
If I change Build Definition to use MSBuild 12 the issues are logged but not on MSBuild 14. And no issues are logged when I execute the process from Command Prompt using MSBuild 12 or 14. From what I can see all the result files and everything still works they are just not imported into sonarqube.
edit: Relates to this Question basically I am trying to find the actual problem and solution
The doc you point at does not mention SonarLint at all. The v2 (in the compatibility matrix) refers to the version the SonarQube Scanner for MSBuild so with Scanner for MSBuild v2 and C# Plugin v5 you're all good. SonarLint is a different thing altogether, you shouldn't care about some of its libraries being embedded in the C# plugin.

Typescript NuGets: compiler vs msbuild

There are two NuGets offered by Microsoft for Typescript.
Compiler
MsBuild
I have a visual studio project that I want to run on an old build machine that does not have a current Typescript installed (It is running TFS Build 2010).
But I need to build my project with a new version of Typescript.
Do I need the compiler or msbuild nuget? (Or are neither of them going to work for what I need?)
Update: I tried the MsBuild version and it took my working project and broke it. I got a ton of compiler errors. (Cannot find name.... errors).

Unable to execute FxCop rules with MSBuild SonarQube Runner

We are facing issues while analyzing .NET projects using SonarQube 5.1.1.
Please note that FxCop rules are enabled at Quality profile level.
We are using MSBuild SonarQube Runner to analyze the projects. But we are facing error which says sonar.cs.fxcop.assembly must be set.
We have faced similar issue with sonar-runner-2.4 but at that time this parameter can be passed with sonar-project.properties file.
But as sonar-runner does not support .NET projects, we are using MSBuild SonarQube Runner now.
Could you kindly confirm how we can avoid these issues with MSBuild SonarQube Runner and execute FxCop rules on the .NET projects?
C# plugin version is 4.1.
Please let me know if any further information is needed from our end.
We have postponed our Production Sonar upgrade due to this issue as Project teams are NOT OK with disabling FxCop rules at Quality Profile level.
Kindly help us in fixing this.
Thanks,
Sri Priyanka
I thinks you should read http://www.sonarqube.org/easy-analysis-of-visual-studio-solutions-with-the-sonarqube-scanner-for-msbuild/ and http://docs.sonarqube.org/display/PLUG/C%23+Plugin .
Pay attention to the fact that you should run the commands from a "Developer Command Prompt for Visual Studio 2013 or higher" (http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+MSBuild). Neither DOS Command Prompt nor Windows PowerShell work because they don't set the proper variables.
The FxCop native support doesn't mean that it comes with MSBuild SonarQube Runner, but you have to install Visual Studio >= 2013.
Moreover, I found that not only sonar-project.properties has been deprecated, but you have to remove it to avoid strange behaviors.

monodevelop won't compile VB code

I wanted to have a look at monodevelop, thinking about possible moving in-house projects written in .Net from Windows to Linux.
I installed mono-complete 4.0.2 and monodevelop 5.9.4 on a clean Ubuntu 14.04 VM, I assume those are the latest/current versions.
Now C# works, but I can't get it to compile any VB code.
Any new VB project I create first refuses to load.
Quickly found (Google) that the mono VB compiler doesn't support framework 4 or higher yet, but the project template generates projects targeted at 4.5.
After I manually edit the project file to target 3.5, 3.0 or 2.0, the projects load (this works for console as well as GTK projects).
But when I try to compile it then, no own code added yet, just the auto-generated base code, it just fails without any error messages.
Build output:
Building: VbHelloConsoleWorld (Debug|x86)
Build started 7/3/2015 10:42:20 AM.
__________________________________________________
Project "/home/luc/projects/VbHelloConsoleWorld/VbHelloConsoleWorld.vbproj" (Build target(s)):
Target PrepareForBuild:
Configuration: Debug Platform: x86
Target GenerateSatelliteAssemblies:
No input files were specified for target GenerateSatelliteAssemblies, skipping.
Done building project "/home/luc/projects/VbHelloConsoleWorld/VbHelloConsoleWorld.vbproj".-- FAILED
Build FAILED.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.0438100
---------------------- Done ----------------------
Build successful.
Am I still missing some dependencies? Other stuff that must be fixed before a VB project will work?
For some reason building VB.NET with MSBuild does not work.
To workaround this you can disable the use of the MSBuild build engine. Go into project options, Build - General and uncheck Use MSBuild build engine. Then the project should compile and generate an output assembly.