Assemblies created in wrong directory

I’ve started looking into organizing my code using assemblies and it was all going well untill I had to create a second one. I’ve then noticed that my project breaks as soon as I create an “Editor” directory anywhere as well.

Thankfully, I can just revert to before I’ve spent a day trying to get this working properly so if it’s too complicated I might do that.

I’ve created and assembly definition called Tools.asmdf and placed it in my Assets/Scripts/Tools directory. It all worked fine whilst all my code was in here.
I’ve then created a second assembly called Generators.asmdf and placed it in my Assets/Scripts/Generators directory. All the scripts are in the same and lower level directories as this assembly definiton. Same for the Tools one.

I’ve linked the two together, specifically, my Generators depends on Tools and disabled Auto Reference for both of them. The problem I have however is that I can’t reference classes within the Tools assembly from the Generators one. There’s no namespace or class name overlap.
Trying to figure out what’s going on I’ve realised something suspicious.My assemblies’ DLLs are all in the Library/ScriptAssemblies directory within the project root, however, in Visual Studio 2019 it says that the reference is in obj/Debug. If I remove that one and add it back manually from within Visual Studio it all works fine again. But, any time I change a script, Unity overwrites it and causes it to revert to the broken path.

I’ve searched far and wide, asked friends for help and went through what must be all the options I could think of in Visual Studio and everything in Unity to no avail. I’m sure I’m missing something but got 0 clue what.

Any pointers would be appreciated.

I’m also seeing this. After upgrading my project from 2019.3.7f to 2019.3.12f, all asmdef project references were not being correctly interpreted in Visual Studio. Specifically, whilst in the unity editor the project would build and run, in Visual Studio references would not connect, giving the error that “The type or namespace ‘x’ could not be found. Are you missing a reference?”

To fix this problem I have tried:

  • Restarting visual studio and unity
  • Refreshing the solution and projects
  • Restarting my computer
  • Deleting all projects and solutions, the obj/ folder, and the Libraries/ScriptAssemblies folder

The thing that finally solved it was as vladerc said:

  • Going to project settings, adding the Libraries/ScriptAssemblies folder to the references paths
  • Removing each project reference from the references list of each project
  • Readding the project references

This seemed to help Visual Studio recognise where the references actually where.

Can confirm, assembly refernces is broken in 2019.3.12

Same here - Visual Studio goes nuts with Unity 2019.3.12 :rage:

Well, crap. I thought it was me missing something obvious … I guess it’s reverting back to the old way. Thanks evryone for checking :slight_smile:

Two things, first, for me it doesn’t build from Unity. It runs in the editor fine but when I go to actually build it, it craps out.
Second, did it work in 2019.3.7? I’ve never tried it before so if that works I might rever to that version of Unity since I quite like the concept of assemblies, not to mention the time savings that come with it.

So, because I had another hour to waste I installed the 2020.1.0 beta Unity Editor and what do you know, everything worked out the box … Hopefully it gets fixed soon.

It is broken only in 2019.3.12

Unity says it’s been fixed in 2019.3.13, though haven’t gotten around to trying it out:

Yes, it is working there