Assembly-Csharp.csproj unloaded in visual studio

I have just got back into game making with unity after a one year break, and after installing unity hub 3.0, unity 2020 (the recommended version) and visual studio 2022. I attempted making a script and noticed that intellisense wasn’t working in visual studio, so I tried closing visual studio and re opening the script (which automatically opens visual studio), but I got an error message saying that one or more files failed to load (which ended up being Assembly-Csharp). I’ve tried many things that I’ve seen online like right clicking it and clicking reload, deleting and regenerating the files, and deleting and reinstalling Assembly-Csharp through unity, but nothing has worked.

It seems that the issue is that visual studio cant load any .csproj files (I tried regenerating all possible .csproj files in unity but visual studio couldn’t read any of them), which puts all the .cs files into ‘miscellaneous files’ meaning intellisense wasn’t working for them. I have also tried using unity 2019 (what i used to use) and visual studio 2019, but the same issue still applied.

this seems to happen even when creating a new unity project or even deleting unity and visual studio and reinstalling them.

Does anyone know how I could fix this?

here is the error message (using unity 2020 and visual studio 2019 for this one):
C:\Users\jacqui\OneDrive\Desktop\unity_games\test\Assembly-CSharp.csproj : error : The imported project “C:\Users\jacqui\OneDrive\Desktop\unity_games\test\obj\Assembly-CSharp.csproj..props" was not found. Confirm that the expression in the Import declaration "C:\Users\jaken\OneDrive\Desktop\unity_games\test\obj\Assembly-CSharp.csproj..props” is correct, and that the file exists on disk. C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Microsoft.Common.props

Please go to Edit > Preferences > External tools . Then Click External Script Editor and choose your editor of Microsoft visual studio 2022.
After that click appeard button “Regenerate project files” .

Or more generally…

This may help you with intellisense and possibly other Visual Studio integration problems:

Sometimes the fix is as simple as doing Assets → Open C# Project from Unity. Other times it requires more.

Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

Barring all that, move on to other ideas:

Also, try update the VSCode package inside of Unity: Window → Package Manager → Search for Visual Studio Code Editor → Press the Update button

Also, this: No suggestions in Vscode

Step 1: Try Reloading

in visual studio, at solution explorer, at the Assembly-CSharp, right click and choose reload.
then the error is resolved and c# source code is showed and with the code suggestion tool is running.

  • Right-click the unloaded project → Reload Project.
  • If it works, the issue might have been temporary.
1 Like