Visual Studio csproj files can't be read, and don't autogenerate. Can't reference UnityEngine.

It just suddenly stopped working altogether. All scripts appear under the “miscellaneus files” assembly, and both the .sln and the .csproj files aren’t generated in any way.

The most conspicuous error comes from Unity, which from time to time logs:
XmlException: Name cannot begin with the ';' character, hexadecimal value 0x3B. Line 27, position 1693.
With the callstack pointing towards:
VisualStudioIntegration.SolutionSynchronizer.SyncProject (full stack on the quote at the end).

I can’t reference UnityEngine, so no MonoBehaviour nor anything Unity related.

Everything I’ve tried which has failed miserably:

  • I checked all .csproj files looking for said ; character out of place. Nothing weird. It is usually the middle of some common and normal preprocessor directives.

  • I have a second computer with the project running smoothly, so I tried . I tried removing all project settings, .sln and .csproj files and copying them from over there. Failed.

  • I tried deleting Library and reimporting. Failed.

  • I tried deleting everything but Assets. Nothing.

  • I tried deleting the project and redownloading from collab. Failed.

  • I tried bringing that other working project here. Nothing.

  • I tried to repair Visual Studio Community 2019. Still failing.

  • I tried to install VSC2017. Nothing.

It is not only frustrating because I have not the least tiny bit of clue to follow, but because I did nothing in particular for it to happen. It simply began happening after creating a script like any other script (no weird characters or anything else I haven’t been doing the last 6 years).

Any clue?

Found it! There was a special character ‘<’ in the Scripting Define Symbols in the Build Settings, which made the XML parser think the following ‘;’ was the beginning of a new define.

It didn’t even generate those new .csproj files, that’s why I couldn’t find the weird character in them.