Assembly references not working

After upgrading to 2020.2.0f1 and 2020.2.1f1 references to the assemblies in our project doesn’t work when compiled in VS2019. For instance, we’re using NavMeshComponents and the NavMeshComponents assembly compiles fine but the NavMeshComponentsEditor assembly, which references NavMeshComponents doesn’t due to the classes in the NavMeshComponents assembly not being visible to the classes in the NavMeshComponentsEditor assembly. The NavMeshComponentsEditor assembly does contain a reference to the NavMeshComponents assembly and when I look at the NavMeshComponents assembly in ObjectBrowser the namespace and corresponding classes shows up as expected. 2019.4.18f1 doesn’t exhibit this problem. Is there a fix to this issue?

Best regards,
Staffan

First get your project under source control if it isn’t already.

Then try reimport all to trigger a full recompile.

If that doesn’t work, try update all your packages, particularly the navmesh stuff and perhaps the Visual studio integration stuff.

This may help you with intellisense problems:

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

Hi there Kurt-Dekker,

Thanks for your reply. I should have mentioned that I’ve upgraded to NavMeshComponents-2020.2 and to the latest version of all the packages I’m using. Also, the problem is that the compiler isn’t able to see/locate the namespace and classes in the referenced assemblies. Hence, I get compile errors, so this issue isn’t really about the VS editor/intellisense not being able to see/locate the referenced assemblies (even though they don’t either), but about something more severe as the compiler isn’t able to see the referenced assemblies.

Best regards,
Staffan

Try regenerating your project files. I have to do this everytime I upgrade.

Hi there Spryx,

By regenerate my project files, do you mean to reimport my assets (Assets/Reimport or Assets/Reimport All)? I’ve tried that several times as well as manually deleting the generated cs project-files and letting Unity re-generate them to no avail. I’ve tried this with both 2020.2.0f1 and 2020.2.1f1 btw.

Best regards,
Staffan

No. I believe under project preferences there is a button to regenerate .csproj files. This is the one you want.

Spryx,

Thanks for the info. I found the setting. Unfortunately, it didn’t help. It seems I have no other choice than reverting to 2019.4 and hope this issue will be fixed in an upcoming release.

Best regards,
Staffan

Sorry, sounds frustrating. That’s super odd. Are you sure they didn’t change namespaces on something? (they’ve been known to do that from time to time). I’m out of ideas. Hope you are able to fix it.

I am having the same issue with 2020.2.5f1. Everythign works fine in 2019.4 but as soon as I upgrade assembly references are somehow broken.

I’m having the same issue with 2020.2.3f1 but with just one out of two of my projects. I’ve tried comparing them but settings-wise they are the same.

I have the same problem after switching from 2020.3 to 2022.

Assembly References in my project could not be resolved in VisualStudio (Unity 2020.3.8, VS Studio for Mac 17.3.7).
btw - I had no compile errors in Unity.

that solution worked for me:
I have closed Visual Studio and then manually deleted all *.csproj and *.sln files in my project root directory. after launching VS again, all csproj and sln files where created again - and it worked. all references could be resolved in VS again :wink:

3 Likes

Thanks for the solution! In my case, after I deleted the *.csproj and *.sln files, Visual Studio showed “This project needs to be migrated” in the solution explorer. When I restored the deleted files to replace the newly created ones (this time without first closing VS), then said yes to VS’s reload prompt, everything somehow worked.