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 Dan-J-31 · May 14, 2015 at 03:40 PM · dllmono.netlibraryexcel

How do you integrate the EPPlus library into Unity?

I'm running into issues integrating the library called EPPlus into my Unity project. I rely on this library to create .xlsx files that organize a bunch of data gathered from a play session once the game has finished running.

Initially, when I added the .dll to my project, I received an error that looked like this:

 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.

I did some searching, and found that going to the player settings and setting the configuration option "API compatibility level" to '.NET 2.0' instead of '.NET 2.0 subset' fixed this issue. This was great and all, and I proceeded to use the library with great joy. It spit out .xlsx files exactly how I wanted it to, and everything was going fine. Except there is one catch: this only works in the editor.

As soon as I started to compile a standalone build, I ran into more issues. The 2 error messages I received are as follows:

 ArgumentException: The Assembly PresentationCore is referenced by EPPlus. But the dll is not allowed to be included or could not be found.

 Error building Player: Extracting referenced dlls failed.

This is where I am stumped. I did research on what is allowed/not allowed in the Unity engine when it comes importing external code, but everything seems like it should work. Unfortunately, it does not. I was wondering if anyone here has any insight as to why this library would not function well with Unity.

Some more information about the issue:

  • I have a free version of Unity, and the current version is 4.5.2

  • EPPlus.dll is a managed library and it does not use native code (AFAIK), so Unity Pro and [DLLImport] functionality is not required.

  • EPPlus.dll is compatible with .Net Framework 3.5, which I believe is the last version that MonoDevelop supports.

  • The EPPlus.dll currently resides in the Assets/Libraries path in my project, but I have also tried Assets/Plugins to no effect. In fact, it doesn't really matter where I put it as long as it is in the Assets folder and not in a folder named "Editor".

Comment
Add comment · Show 2
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 Graham-Dunnett ♦♦ · May 14, 2015 at 03:40 PM 0
Share

The error says that PresentationCore.dll cannot be found. Where in your project is it?

avatar image Dan-J-31 · May 14, 2015 at 11:45 PM 0
Share

PresentationCore.dll is one of $$anonymous$$icrosoft's .NET libraries, so I assumed that its inclusion is somehow done automatically (as some things are in Unity). I guess that was a bit silly to assume that.

I did end up including it in my project manually, but then PresentationCore.dll required another library, named UIAutomationProvider and then that library required another one, and then that one required the library System.Deployment.dll, of which there are roughly 20 different versions on my computer. I tried most of them, but every one of them got me this error: TypeLoadException: Could not load type 'System.Runtime.ConstrainedExecution.ReliabilityContractAttribute' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, Public$$anonymous$$eyToken=b77a5c561934e089'.

I went back to the documentation for EPPlus, and it seems like they did add some $$anonymous$$ONO compilation directives, however their FAQ states that they aren't sure if its even compatible with $$anonymous$$ono...

In either case, if something is trying to access mscorelib, then I'm assu$$anonymous$$g that's calling native code, and I won't be able to do that anyways.

Well, I guess I'll keep trying, but this is starting to look like a dead end.

2 Replies

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

Answer by NextLevelLab · Jun 20, 2017 at 10:30 AM

If you have set up everything correctly so that your epplus.dll works in Editor Playmode, but doesn't in Standalone, try this: http://answers.unity3d.com/questions/378005/ioniczipdll-does-not-work-in-build.html?sort=votes

Importing those additional .Dlls solved the issue in my case (I had the same problem that EPPlus didn't work in Standalone)

SO: EPPlus DOES work in Unity.

Comment
Add comment · Show 4 · 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 silentslack · Sep 28, 2017 at 02:48 PM 0
Share

Hi I'm trying to do the same. I've added the I8N*.dll to my project but still no luck. Is there anything else required?

Thanks!

avatar image silentslack · Oct 02, 2017 at 03:58 PM 0
Share

I also got this to work in a build. I included:

PresentationCore.dll System.Deployment.dll system.windows.input.manipulations.dll UIAutomationProvider.dll UIAutomationTypes.dll

And the .dlls from the thread linked.

Cheers!

avatar image Dan-J-31 · Oct 02, 2017 at 06:47 PM 0
Share

Interesting. Even though I don't need this library anymore, this is still useful for others who are trying to integrate the creation of .xlsx file in their games. Good to hear that you guys figured out how to get it working!

avatar image bhupiister · Nov 09, 2020 at 10:18 AM 0
Share

This method worked for me. I can confirm that it works on Android build along with charts and functions in Excel files created.

avatar image
0

Answer by Dan-J-31 · Jul 01, 2015 at 07:24 AM

Forgot to update this question. It seems like the EPPlus library is indeed compatible with Mono, but it is not compatible with Unity. Unity intentionally, and seemingly arbitrarily, prevents you against linking with particular libraries in the .NET framework, and this is the core of the issue.

I think the reasoning behind this was to prevent your project from linking with platform specific libraries (due to Unity being multi-platform and all). I don't know if that is the actual reason, but that is my guess.

So in summary: no, the EPPlus library will not work in Unity.

Comment
Add comment · Show 3 · 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 meat5000 ♦ · Jul 01, 2015 at 07:28 AM 0
Share

So Ive not actually looked at this video. Have you watched it?

Unity 3D + EPPlus Youtube

@Dan-j-31

avatar image Dan-J-31 · Jul 01, 2015 at 04:40 PM 0
Share

I've skimmed through that video before, but I haven't watched it in full. While I don't understand Spanish, I can make assumptions based on what he's showing in the video.

I think the video is more of a tutorial on how to use the EPPlus library. From what I understand, he never actually compiles a standalone build of his project. He only uses the editor to create the excel files. This makes sense as I had success doing this too, the problem was actually getting a standalone build to compile.

avatar image meat5000 ♦ · Jul 01, 2015 at 05:00 PM 0
Share

Fair play, thought you might have seen it. Just wanted to make sure. Sorry it was of no use.

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

6 People are following this question.

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

Related Questions

MonoDevelop DLL Build : Problem with default parameters 1 Answer

It's possbile to export data to excel(.xls) in unity? 1 Answer

Getting SSH.NET to work in Unity 1 Answer

The classes in the module cannot be loaded? 0 Answers

The type or namespace name... again 0 Answers


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