I had c# class library that, when built, would copy itself into Assets\Scripts\Libraries\ and it would also add its dependencies, which was UnityEngine.dll and UnityEditor.dll to the same folder.
I set it up to build into that folder by changing the Output Path under Properties->Build->Output at the class library in Visual Studio 2010.
The problem went away when removing UnityEditor.dll from that folder. I guess Unity3D doesnt like importing things twice.
So what I did then, to further automate the process was to edit the Properties->Build Events-> Post-build event command line to the following:
Del "UnityEngine.dll"
Del "UnityEditor.dll"
Del "nunit.framework.dll"
Del "My Library Project.pdb"