- Home /
.asmdef files and Libraries with DLL files only. Source editor doesn't see any Classes.
I'm trying to use .asmdef files in my project. I put .asmdef files to all external libraries, but my source editor didn't see any library classes from libraries with DLLs only (for example Firebase).
How to resolve this issue?
Answer by Bunny83 · Apr 11, 2019 at 11:48 AM
What do you mean by
I put .asmdef files to all external libraries
assembly definition files control the compilation of source files into seperate assemblies. If you have already compiled libraries asmdef files are pointless. Also what is your "source editor"? If you imported a third party C# assembly into your project, Visual Studio should "see" the classes defined in those already compiled assemblies. Not the source of course, but the class members, signatures of the methods, etc.
What kind of DLLs do you actually import? If it's a native code plugin (C++ / C library) you need some C# wrapping code. If it's actually a C# assembly, just make sure you set up the dependencies / references for your own assemblies correctly. So if your classes which you put in a seperate assembly (by using an asmdef file) should have access to one of the third party assemblies, you have to put that third party assembly into the references of the asmdef file.
Just think of an asmdef file as a seperate C# project that only contains some of your files. It will be compiled seperately from everything else into its own assembly. Of course you have to specify which other assemblies you depend on.
I will try to explain on an example: 1. Your current project has two folders: src(contain your own scripts), Text$$anonymous$$esh Pro(third-party library) 2. You added to src file .asmdef
. All code in this folder will not see any class members, signatures of the methods, etc. from other folders which not have .asmdef 3. Ok, You will add .asmdef
to Text$$anonymous$$esh Pro and set reference in .asmdef
file in src folder and it will work.
But if a third-party library will contain only DLL files (for example Firebase) this solution will not work.
You can setup two types of references in the asmdef inspector. First there are the "Assembly Definition References" so you can actually reference other assemblies that are created with asmdef files. Second there's the normal "Assembly References" where you should be able to reference any already compiled assembly (as long as the assembly is an actual managed .NET assembly). Actual native code plugins (DLLs which are not .NET assemblies but actual C++ / C native code DLLs) have to be placed inside the plugins folder. However as i said such DLLs need some sort of managed wrapper code (a class with some external declarations).
ps: It looks like Firebase does actually ship managed assemblies (or maybe they are just managed wrappers). So you should be able to setup the references you need in your own asmdef file.
Your answer
Follow this Question
Related Questions
Adding Game Assembly causes type or namespace errors 0 Answers
Obfuscate variables in release build? 1 Answer
accessing a class by interface requries reference to other unrelated interface's assembly 0 Answers
SVM, machine learning in Unity 1 Answer
I want to use Unity library or API's in Visual studio project with my own viewer. 0 Answers