Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by HSMInteractive · Jan 11, 2014 at 09:02 PM · build-errormonodevelopdllinternal-compiler-error

Added custom DLL. Internal Compiler Error

I'm aware there are a lot of these problems floating around but nothing seemed to fit my situation. I've created a custom DLL for use in both a WinForms app and Unity. I added it to the project, added it to the references folder in MonoDevelop and started coding. Everything builds fine with no errors but when I go to build the project, I get this error:

 Internal compiler error. See the console log for more information. output was:
 Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
 
   at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
 
   at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 


Would it have anything to do with my DLL? Do I need to re-write it import it correctly or something? I'm really at a loss here.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Efril · Jan 11, 2014 at 09:36 PM 1
Share

Are you sure your DLL compiled for 3.5 version of .NET Framework?

avatar image HSMInteractive · Jan 11, 2014 at 10:01 PM 0
Share

Ohhhhhhhhh. I believe its 4.0. Also, it uses [DLLImport] to reference kernel32.dll. Could that cause an issue?

avatar image Efril · Jan 11, 2014 at 10:29 PM 0
Share

I believe [DLLImport] should not be a problem while you targeting your Unity application to Windows. But not tested myself.

6 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by HSMInteractive · Jan 11, 2014 at 10:13 PM

I fixed it. I rebuilt the DLL under the 3.0 framework and it seemed to be good.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Garth-Smith · Jul 08, 2015 at 01:31 AM 1
Share

Using Unity 5.1 and I only had to lower it to the 3.5 framework to get rid of this error message. In Visual Studio 2013 it can be found under the Project menu, ProjectName Properties, Application (default) tab, Target framework dropdown.

avatar image
1

Answer by MrLucid72 · Jan 20, 2016 at 09:28 AM

For me, it was the imported store asset. I deleted the plugins folder and all is well.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Bunny83 · Jan 11, 2014 at 09:09 PM

You shouldn't modify the Monodevelop project since it is created and updated by Unity. You simply have to copy your DLL into your project, somewhere in your assets folder or subfolder.

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HSMInteractive · Jan 11, 2014 at 09:12 PM 0
Share

Thats what I did. Then in the "References" folder on the left side of $$anonymous$$onoDevelop where all the DLL's are mentioned, I added it there.

alt text

ex.jpg (35.6 kB)
avatar image Bunny83 · Jan 11, 2014 at 09:33 PM 0
Share

You don't have to add it there. When you sync the project it will be updated automatically.

Is it possible that this question isn't about a Unity project? It seems you try to build a .NET / $$anonymous$$ono project and included the UnityEngine.dll. That's not possible at all. The UnityEngine.dll is just an "interface" into the UnityEngine which is written in native code. If it is a Unity project, as i said, you shouldn't change anything in the $$anonymous$$ono project itself. Whenever you add or modify a script, Unity will update the project automatically. If not you have to press "Sync $$anonymous$$onoDevelop Project" to manually update the project.

ps: The UnityEditor.dll only works in the Unity-Editor application. It references native parts of the editor application. That's why UnityEditor.dll can only be used in Editor scripts.

It would help to know what you're actually doing and what you want to achieve

avatar image HSMInteractive · Jan 11, 2014 at 09:51 PM 0
Share

Ok. I made a DLL in Visual Studio. It contains stuff for reading INI files. I added it to my Unity project so my game can also read INI files (config files). I hope that makes sense. I'm only using $$anonymous$$onoDevelop for my Unity game. It has nothing to do with any UnityEngine.dll files and whatever else you mentioned.

avatar image HSMInteractive · Jan 11, 2014 at 09:54 PM 0
Share

I removed the script from my Unity project and was able to build the project. The custom DLL was also exported into the $$anonymous$$anaged folder of my game's data folder. It appears to be an issue with script then.

avatar image HSMInteractive · Jan 11, 2014 at 10:00 PM 0
Share

Now I get the error every time I add a new script.

Show more comments
avatar image
0

Answer by valentemesmo · Jun 02, 2015 at 02:34 PM

In my case, I had AndroidJavaObject on a DLL used in All Platforms... I moved all AndroidJavaObject to a Android only DLL... problem solved!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by mateiasu · Jul 27, 2015 at 11:35 AM

I had an Editor and Runtime library put into their appropriate folders ( /Editor and /Plugins ). Unfortunetly the Editor library was built for target Mono / .net 4.5. (Why did I not see this in first place? .. continue reading .. )

IMPORTANT! I've suspected & deleted the Runtime library since it was the only thing that I've changed and it did work before with the Editor library and Unity3D did say everything ok, even that the error was inside / related to the Editor library!!!

Conclusion: Do you have an Editor dll? Try delete it. ;)

Hindsight: Maybe Unity could throw an appropriate error pointing to the assembly causing the compilation error?!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

26 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Edit asset DLL? 1 Answer

How to use Unity's mono to compile in MonoDevelop 2 Answers

Error building Player: Extracting referenced dlls failed. 8 Answers

How to use an Image(PNG) and GUISkin inside a dll ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges