Home > front end >  All lines in Visual Studio are squiggly red
All lines in Visual Studio are squiggly red

Time:01-26

I'm sure this question has been asked before, if there's a similar question with a solution I apologize in advance. I've tried to find something similar to this in the forum already but I can't find any solutions.

So I recently swapped to a new computer. I installed Visual Studio, same version as I used previously, and I also installed .NET 7 (which I used previously aswell).

I started my project in Visual Studio and everything in my code is squiggly red. Literally everything, except the names of variables. It can't find any of the namespaces, not even System. I've tried going through the settings, re-installing NuGet packages, removing bin folders, removing packages folder etc. I can't seem to find the issue, afaik there's no major difference between my old laptop and the one I'm currently using. It's the exact same project files. The files work on my old laptop.

Not sure if I've missed something really obvious. Very thankful for any help.

Some images to showcase the error:

Squiggly red lines on almost everything

CodePudding user response:

Allow NuGet to download missing packages :

I ran into the same issue previously, doing this resolved it for me.

If not, could you provide the .csproj file ?

If possible could you please Build

CodePudding user response:

So, seemingly after attempting everything I could find online (including the steps below), I attempted this with success:

  1. Clean solution
  2. Restart Visual Studio
  3. Remove packages folder
  4. Restore NuGet packages.
  5. Rebuild solution
  6. Repeat around 10 times.

If anyone has this issue and can't get it to work, just keep repeating the steps. I had to do it over 10 times before it actually worked. I'm still not sure what caused it but this was my solution.

  •  Tags:  
  • c#
  • Related