2

I've been testing some c# code in visual studio and when I opened visual studio this morning my project was full of red lines.

  • Demanding class declarations to be closed with End class
  • Red lines under semicolons
  • Variable declaration without an AS clause
  • Ctrl+K, CTRL+C Gives visual basic comments E.g. 'green text
  • //C# comments get red squiggly lines under them.

These are clearly visual basic errors which means for some reason it's trying to make my C# into VB.

I've been trying to find out what on earth to search for but no luck so far.

When I build the project there is no problem. Just the syntax errors in visual studio with red squiggly lines.

2
  • If you create a new C# project (new instance of VS, new solution), does it do the same in that? Also, what version/edition of Visual Studio? Have you already e.g. attempted to run a repair on it? Commented May 5, 2017 at 11:59
  • It did not happen in a new project. Though I'm uncomfortable not knowing what caused it. Commented May 5, 2017 at 12:25

1 Answer 1

0

Have you try to :

  • close VS
  • delete .SUO file
  • restart VS

The SUO file is a hidden file,, which is placed in the same folder as the SLN file. It contains a lot of information such as which files are currently open in the IDE, some local settings, etc.

More Information about that.

Sign up to request clarification or add additional context in comments.

2 Comments

Restarting helped but it did so before and then snapped back to the problem so I expect it might do so again. There is a small dropdown above the code to the upper left that says "Miscellaneous files" with a c# icon to it's left. When that is there the code is fine. After a while something happends and it changed to 1_filename.aspx.cs and then to 2_filename.aspx.cs and I have no idea what i did but the errors were back.
Miscellaneous files means VS doesn't recognize your file as a part of your project. So you can try to exclude this file in Solution Explorer, Right click on your projetc folder, Add, Existing file and select your file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.