Unable to add script to solution in Visual Studio

I’ve got a new problem I don’t know how to solve. I’m not entirely sure what it’s trying to do behind the scenes, and I don’t know where Visual Studio thinks the folders are.

I’m trying to add an “Editor” folder under another folder under Assets to store a script. If I create the folder and script through Unity and launch into the script, it loads Visual Studio but the folder nor file are listed in the solution. So I decided to try it the other way around, closed the script, deleted it and the folder from Unity, and then tried to add the folder from Visual Studio. But trying to do it that way, Visual Studio gives error “Cannot add a link to the folder Editor. There is already a file of the same name in this folder.”

So it says it’s there. But if I look under Assets in just a File Browser window, it’s not there. Where is Visual Studio trying to link to? How do I fix this?

Related to that, how can I best avoid this in the future when I’m adding C# classes to the project? Should I always add them through Unity? It seems that fails sometimes. And I often just want to add some generic class, and it seems the only way to do it is add a MonoBehavior script and then just convert it into something else in Visual Studio. Should I always add them through Visual Studio? So far this seems to work, but I don’t know if this can maybe confuse Unity.

I just abandoned the “Editor” folder and used a new name. So that’s one way around it. But I know something is still broken underneath.

For now, I’m continuing to add scripts from Unity, because I feel like that is what I’m probably supposed to do. Although they didn’t really design it for adding generic classes. I just keep adding Monobehavior scripts and then changing what the override is to what I really wanted (sometimes nothing, sometimes an abstract class)

Editor folders go under a different assembly. I’m wagering that it is there, just under a different assembly in the solution?

You can see the different assemblies Unity generates here: Unity - Manual: Special folders and script compilation order

You can of course define your own assembly definitions, too.