Using 2 DLLs with the same name

I have a DLL (let’s call it A.dll) that depends on another DLL (let’s call it B.dll) that has two different versions, one for mobile and one for standalone. I want unity to choose the correct B.dll for the build.

My current file structure for my project is something like

-Assets
  -Libs
    -A.dll //depends on B.dll
    -B.dll //this has it's platform settings set to standalone targets
    -MobileLibs
      -B.dll //this has it's platform settings set to mobile targets

I’ve set the target platforms in their respective inspectors to be mutually exclusive so there is no name clash when I run the game in the editor but it always uses the standalone B.dll even when I set the player to a Mobile platform. Even worse, if I delete the standalone version of the B.dll, it can’t find the other B.dll that is in the MobileLibs folder.

How can I get this to work? Are there any special folders I need to put these into? I’ve tried renaming the folder Plugins but that didn’t seem to make a difference either.

These are C# libraries built using MonoDevelop if that helps.

For anybody seeing this question in the future, having two DLLs with the same name is fine so long as they target different platforms and are in different directories (the above example, in the question describes such a case).

My problem was that I was trying to use a DLL to wrap UnityEngine.Advertisements content. Although it is possible to do so, it is not possible to setup the DLLs in such a way that the target build platform is reflected correctly during Play Mode in the editor. Only precompiler macros can properly do that but they are not effective in DLLs.

Unity will assign the precomplier directive UNITY_EDITOR, when compiling for the editor, (including the editor-“player”)
When compiling for a final project/platform, UNITY_EDITOR is NOT defined.

So…

#if UNITY_EDITOR
using a.dll    // used when compiled for the editor (what you get when you hit play)
#else
using b.dll   // used when compiled for the runtime project.
#endif

(Both dll’s would live in your regular asset folder.)

EDIT: I should also mention, that each target option has a place where you can specify your OWN preprocessor pragma. You can assign each target a different pragma, and use the pattern shown above, replacing with your own pragmas.

I THINK you have that part already understood though, and it sound like you want to know how to compile the DLL itself.
THAT answer is really ugly. Here is how I did it: How to: Conditional use of UnityEditor In DLL? - Questions & Answers - Unity Discussions
(I really hope someone posts a better way!)