Custom DLL not (quite) recognized by Unity (95865)

Hi all

Apologies for the vague title. I have an odd situation where I have added my proprietary DLLs to my Unity project and one is not usable.

My DLLs are made in Visual Studio 2013 as a Class Library. The projects have been setup for compatibility with .NET 2.0 as described here: http://fernandogamedev-en.blogspot.co.uk/2012/08/how-to-create-dll-library-to-unity3d.html

I have added the compiled DLLs to my UnityProject/Assets/Plugins directory:

I’m able to use the DataLayer DLL, however the BusinessLayer DLL does not show in autocomplete:

Now, the interesting this is if go ahead anyway I soon find that autocomplete starts working on objects contained in the DLL:

So something strange is going on with Monodevelop’s autocompletion. Unfortunately, this isn’t all. Running the following script causes errors:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

using Athgo.Services.Common.BusinessLayer;


public class AthgoLibraryTest : AthgoMonoBehaviour
{

	protected override void Awake()
	{
		base.Awake();

		NoteManager noteManager = new NoteManager();
		List<Note> notes = noteManager.GetAllNotesList();
		Debug.Log(notes.Count);
	}

}

Assets/Scripts/Test Scripts/AthgoLibraryTest.cs(17,17): error CS0246: The type or namespace name `NoteManager' could not be found. Are you missing a using directive or an assembly reference?
Assets/Scripts/Test Scripts/AthgoLibraryTest.cs(19,22): error CS0246: The type or namespace name `Note' could not be found. Are you missing a using directive or an assembly reference?

I’m really not sure how to debug this. Can anyone suggest what I may be doing wrong, or perhaps there’s a bug in Unity?

Thanks,
Ves

1 Answer

1

Try moving your DLLs to the asset folder (out of the plugins folder). The plugins folder is usually for native code libraries. “normal” managed dlls can just be placed somewhere in your project like any other script. Make sure the mono-solution is updated once the dll has been added (Sync MonoDevelop Project)

I have followed your directions and it hasn't made any difference.

Are you sure your namespace inside the DLL is correct ;)

Absolutely. This seems to be confirmed by the autocomplete half-working for the contained objects.

Thanks so much Bunny83, it looks like all of my classes are internal. This ILSpy thing is really cool!

VesuvianPrime, can you describe how you solve that namespace missing error? I'm struggling with the same problem. Only diffrence is that my dll comes from c++/cli wrapper(also mine)