zack_falcon zack_falcon - 1 month ago 18
C# Question

Unity MonoDevelop, creating a DLL - How to ignore errors

I've been tasked with creating .DLL files from the .cs files from a Unity project.

Normally we just take the C# classes (.cs files), import them in MonoDevelop, and build the solution to create the DLL files, reimport the DLL back into Unity, and fix any script references. But the project has become complex, and we've been using Spine2d for animations.

Spine2D is a whole different ball game, one that I do not want to touch and one we could just perhaps leave as is.

But the solution in MonoDevelop fails to build (and wouldn't produce the DLLs), understandably because it has references to Spine, which itself has references to other projects and so on, and so forth.

Is there a way I could force MonoDevelop to just build the DLLs, regardless of the error, and just trust the Unity project to make up for it?

Answer

You can't ignore errors. That's why they are errors. The compiler has to translate the code into IL somehow, and without a proper dependency, it simply doesn't know what to emit. You need to add the references to the required dependencies, or the project can't compile.

The only way around this is to make sure that there are no compile-time errors. For example, you could define interfaces that would be known to your DLL and implemented in the Unity project. Needless to say, this can get tricky real fast, but if you just need a simple adapter, it might be viable.