CS8509 is reported by IntelliSense but not the C# compiler - c#

C# CS8509 warning is about the switch expression not being exhaustive. My Visual Studio reports this warning as error in IntelliSense but not during the build. The build still fails with MSBuild though. What could be the reason that VS is not reporting this error?
The problem happens on both Version 17.4.4 and 17.4.0

The project was skipped during the build. Clean, Rebuilding, closing and restarting Visual Studio did not help.
Removing the project from the solution and adding it back fixed the problem.

Related

Visual Studio references broken after nuget update

We have strange behaviour in Visual Studio 2015.
If a teammate updates some nuget packages the other colleague is getting reference errors as shown in the picture. You are not able to build.
If we click on the erroneous reference the error disappears and everything works as expected. You are able to build.
What is causing this error? This is quite annoying...
Anybody got a solution how to come over this?

C# 6 error messages on VS2013 despite using Microsoft.Net.Compilers nuget package

Over half of our 50 man development team still uses Visual Studio 2013. Despite this, we would like to use C# 6. So we tried using this solution: https://stackoverflow.com/a/32010632/3997704.
Compilation with Microsoft.Net.Compilers works fine, as does our CI environment. However, Visual Studio shows a lot of errors in the Error List related to C# 6 features. I tried getting rid of the errors by using clean solution, rebuild, restarting Visual Studio and clearing ReSharper caches but none worked.
Even though you install the Microsoft.Net.Compilers package in your project, Visual Studio still uses the C# 5 compiler for the editor. That's why it compiles the C# 6 code, but the editor doesn't understand it. Unfortunately, there is no way to change the compiler editor uses and probably never will be.
So the only way for the full C# 6 support is to upgrade to Visual Studio 2015.

Visual Studio can't see methods from DLLs but compilation is OK

I have problem with VS 2013. VS can't see anything from my DLLs but compilation is OK and project works properly. How can i fix that?
thx for your help

Visual Studio 2013 reporting erroneous "does not contain a definition for" error for recent extension methods

Visual Studio 2013 (vs) compiles a solution fine when manually building (i.e., it reports "Build succeeded", there are no errors in the error list, and running a program shows the latest changes). However, when vs starts building in the background (for Intellisense?), then errors start to come up for recently added extension methods. The extension methods are underlined in red, and right-clicking on them to "go to definition" results in an error that says "Cannot navigate to [method name]".
Extension methods that were created (in the same classes as the methods listed in the erroneous error messages) previous to when this started happening do not show up in the error messages.
I have done a build clean, to no avail.
I do not have resharper installed.
How do I reset the intelisense cache in Visual Studio 2013? I see instructions for Visual Studio 2008, but not for Visual Studio 2013.
For Visual Studio 2015, my solution didn't have an .sdf file, and restarting didn't help. However, the following steps fixed my problem:
Close Visual Studio (important)
Go to [solution folder]\.vs\[solution name]\v14
Delete the .suo file
Start Visual Studio
It turns out that closing all open files, then shutting down Visual Studio, and restarting fixed the issue. pff!
I had a similar problem that I resolved by deleting *.sdf file in the solution directory. VS2013 will re-create it.
UPDATE This is what I know now: https://stackoverflow.com/a/38708050/90475
After testing all above mentioned solutions simply clean and build worked for me.
In VS2010, the only thing that worked for me was removing and adding the reference again.
Very old question, but it happened to me also with VS2019. I have multiple projects in my solution: right-click on the project -> "Unload Project" for each one, and then reload them. This worked for me.
Clean + Build, or
Close all the files + restart VS + clean
Those didn't work (for me).

Unable to compile Roslyn project

Today I have installed Roslyn September 2012 CTP. I began with a sample console project. After the IDE finished creating the project code, I pressed F5. I ended up with a dozen compilation errors saying none of the Roslyn namespaces found. However the intellesence options are working fine for those references.
I tried with restarting the Visual Studio and even the my PC as per suggestions I found elsewhere. But none could resolve this. Is there anything that I am missing?
Rep whoring :)
As posted in the comments, this generally happens when there is a .NET Framework target mismatch. Your Visual Studio will be targeting a different version of .NET than what the project or a project reference was developed in.

Categories

Resources