SonarQube no longer detects C# issues - visual-studio

I upgraded my build agent to Visual Studio 2015 Update 3 and I noticed that C# code analysis issues are no longer reported.
I am using SonarQube 5.6

Bogdan, the same happened to me.
You need to upgrade your C# plug-in to be at least version 5.3.1
Indeed, Visual Studio 2015 Update 3 introduced a breaking change in the Static Analysis Result Interchange Format (SARIF) generated by the C#/VB compiler. As a result the C# plug-in could not find any issue any longer. SonarSource reacted quickly by providing a bug fix version (5.3.1)
Note that this should not happen again as now SARIF has moved to version 1.0 (that happened in VS 2015 Update 3, and its versioning will be fully supported moving forward)

Related

OmniSharp Error: Found dotnet version 5.0.201. Minimum required version is 6.0.100

I use VS Code as my IDE. Today I saw in my C# files that I could no longer use things like "Go To Definition/Implementations" or hover over anything to get the path/type etc.
I found my Omnisharp console and saw they updated last night and there is an error:
Error: Found dotnet version 5.0.201. Minimum required version is 6.0.100.
I can't upgrade my dotnet because 6.0 is not compatible with the runtime in my project and on Mac M1, there are a lot of issues running multiple dotnet instances..
I guess its a bit of a rock and a hard place, anyone know how I can get around this issue?
This is a recent update to Omnisharp, which is used by the VS Code C# extension. Add this to your settings and restart the editor.
"omnisharp.useModernNet": false,
"omnisharp.path": "",
Also if you don't have Visual Studio installed you will likely need to install the Build Tools to get MSBuild:
My understanding of the rationale behind this change is an optimization for modern vanilla c# projects over those using older versions (ie Unity). More info in this issue.
Revert your Omnisharp to previous version
Update 1.25.0 introduces newer OmniSharp build for .NET 6 which does not support non SDK style .NET projects but results in performance improvements.
Fortunately you can disable this in the settings:
C# Extension Settings
Also, the C# extension no longer ships with an included Mono & MSBuild Tools. Download them here: Build Tools
Worst case, you can revert to an older extension version.
Go to extensions in VS Code and search for C# Extension
VS Code Extensions
Go to C# Extension settings
C# Extension Settings
Disable "Use Modern Net" option.
Modern Net Option
Restart VS Code
I haved similar problem and i fixed like this:
Im using win7 and i have VS 2019 IDE which not supporting dotnet 6 cuz of that vs_installer not installing dotnet6 sdk, in result i cant use c# extension v1.25.0 in vs code, because omnisharp needs net6. I installed net 6 sdk to my win7 and problem is solved, now i can use c# extension v1.25.0 in vs code.

How to Update Blazor Server App from .net core 6.03, to 6.04

I have a .net core Blazor Server App which is currently using version 6.03 of .net core.
Version 6.04 came out a few days ago, and I need to upgrade the project and then publish it so it is using the new bits.
I have:
Install the latest SDK from here which includes 6.04.
I also used Nuget to ensure all libs are on 6.04.
However, when I open the project, and check the file versions, it is still using 6.03.
I have looked for any setting in the project file that would indicate which version of .net 6, it is using, but I don't see any such setting. I only see this setting:
<TargetFramework>net6.0</TargetFramework>
Is there some way to get VS to use 6.04 instead of 6.03?
After quite a bit of working with this, I found that the minor version is tied to the Version of Visual Studio that you are using.
So, I was using VS 2022 Version 17.2.0 Preview 4, and the .net 6.0.4 bits had not been released yet for this version. So those bits are not accessible from this version.
However, the 6.0.4 bits have been released for VS 2022 Version 17.1.5. So by downloading and installing 17.1.5, the project then opened up using 6.0.4 without any other changes.
I am sure that soon the bits will be released for the 17.2 version soon.

How do I install an older release of Visual Studio 2017?

I brought up a new VS2017 dev environment at work yesterday, which means I got the recently released version 15.3. I'm getting an internal compiler error on a VC++ project that nobody else in the organization is getting; everyone else is still on 15.2. To test my theory that the 15.3 update may have broken something, I want to install VS2017 15.2 (or even 15.1 or 15.0). But I can't figure out how to do that. When I run the 15.0 or 15.1 bootstrapper, it still tries to install 15.3.
I've already gone over this guide for creating offline installations but it doesn't say anything about getting an older release. I found a guide here that shows how to use a specific release with VS2015, but I can't find anything for VS2017.
My work gave me an MSDN account (Visual Studio Professional), which offers older bootstrapper downloads, but does not offer full offline installation downloads for older releases.
How do I install VS2017 15.2 (or 15.1, or 15.0) when 15.3 has already been deployed by Microsoft?
There is support for downloading a prior version, but evidently you have to contact support for the link. None of the links on any of the pages I could find within the VisualStudio.com site referenced it.
Installing an earlier release of Visual Studio 2017
Be sure to take the time to read the "[no]support policy" regarding "earlier" releases. Essentially, the day they released version 15.4, version 15.3.5 was no longer supported.
On another note, I have noticed many people seem to respond (here and on other similar postings) along the lines of "Why on earth would you want to reinstall the same version you were working with instead of the latest release?". Note that I am para-phrasing that to clarify the sentiments commonly expressed.
The reason is because TEAMS of developers need to be on the SAME version of the tool set. They have deadlines and cannot afford to drop everything and switch everybody to a new version of the tools that may or may not work correctly for them. Even if the developers were willing to take that hit to their productivity, usually their managers are not. This is why taking away the option to install the previous version the very same day you make a new release available is an unacceptable practice for Enterprise or Professional grade development software.
Another common reason is that when bugs have to be fixed in software, you often need to use the same, or very close to same, version of the tools to rebuild it after fixing the bug. The costs of regression testing after forcing a non-trivial upgrade on an entire software product or suite is unacceptable to most organizations. Upgrading may not even be an option due to contractual obligations.
It seems that based on this article that Microsoft do not offer a mechanism to download any version of Visual Studio 2017.
The https://my.visualstudio.com site offers bootstrap downloaders for 15.0 and 15.3 only. Intermediate versions such as 15.1 and 15.2 are not available as of September 2017.
I have a modest sized engineering team that would quite like to stay with 15.2 even for new starts and this is quite frustrating as we didn't capture an offline install of anything other than 15.0!
Apparently its possible to install a older version in parallel to a newer one. I just downloaded 15.6.7 from https://learn.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017 and started the install - it didnt touch my existing installation 15.9.19
But the probably better solution is just to install the toolset which is available separately for each VC2017 release. See this intersting article:
https://devblogs.microsoft.com/cppblog/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/

The C# project is targeting ".NeETFramework, Version=v4.0", which is not installed on this machine

Trying to run an old project in Visual Studio 2015. It was created in 2012 or 2013, I cannot remember which. I have uninstalled both programs as I was running out of space, and i think that is what caused this. I get the following options:
And I do not want to change the target, so clicking on the second option brings me to https://www.microsoft.com/net/targeting which I can't seem to find anything there that remedies the situation. Is there a way around this without reinstalling the old version of Visual Studio again? Will that even fix my problem? Thank you.
Just Reinstall Visual Studio. When you uninstalled previous version it caused this problem.
You could try doing a repair reinstall of Visual Studio 2015.
Another point to consider is that Windows 7 (the oldest version of Windows still supported by Microsoft) includes a Windows Update for the .NET Framework v4.6.1 categorized as an "Important" update. I have not confirmed with Windows 8, but I suspect it, too, includes a similar update. Windows 10 comes with .NET 4.6 to start with. That means that any up-to-date supported machine today will be able to run apps targeting any .NET version up to and including 4.6. I recognize that there may be other reasons to continue targeting an older .NET version, but I bring this up just in case the concern is support on client workstations.

How to use newer Microsoft.CodeAnalysis reference in Roslyn analyzer targeting VS2015

Is it possible to upgrade the Microsoft.CodeAnalysis reference to something like version 1.3.x and still get the analyzer to load in VS2015?
I've got this setup working in my analyzer development environment so there seems to be some way for VS2015 to run analyzers that depend on Microsoft.CodeAnalyzer 1.3.1 for example.
However when I install the analyzer off the VSIX package to my office PC that doesn't have the VS SDKs installed VS complaisn that the extension "does not contain any analyzers". Now that I downgraded the Microsoft.CodeAnalysis references back to 1.0.0 everything works again.
How is targeting multiple VS versions supposed to work in the future in case each VS requires a reference to the same Microsoft.CodeAnalysis assembly that it uses internally?
The 1.N packages work with Update N of Visual Studio, but there is no way to use 1.3 packages with something less than Update 3.

Resources