Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by mike0308 · Sep 12, 2017 at 11:38 AM · runtimepluginsbuildingnative plugincompiler error

Unity 2017.1 .NET 4.6 Plugin - System.Runtime assembly not allowed to be included?

I am using a plugin compiled for .NET 4.6, which depends on System.ValueTuple. I'm using version 4.3.0 of this package. Everything works ok in the editor, but when I attempt to build for Windows or Mac OS X I get the following error. Could anybody shed some light on what the issue is here?

 ArgumentException: The Assembly System.Runtime is referenced by System.ValueTuple ('Assets/Plugins/System.ValueTuple.dll'). But the dll is not allowed to be included or could not be found.
 UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:142)
 UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:148)
 UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:148)
 UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, UnityEditor.BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:179)
 UnityEditor.HostView:OnGUI()
 

Additional details: I'm experimenting with running a tensorflow neural network from within Unity. I'm using the rather nice TensorFlowSharp wrapper to do it. However, the wrapper targets 4.6.1 so I have retargeted for 4.6 (fork available here). If I can't get this to work, I'll have to write my own native calls which will be a pain.

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by davidaver · Oct 25, 2017 at 12:44 AM

Recently had a the same problem with a .NET 4.6 library that references System.ValueTuple. Copying the following .dlls from Unity's Mono folder (C:\Program Files\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\Facades) into your project's assets folder should do the trick.


  • System.Collections

  • System.Resources.ResourceManager

  • System.Runtime

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 drhawley · Jan 13, 2018 at 07:46 PM

Trying @davidaver 's suggestion did not cause the error to stop occurring for me. Also tried changing "4.5" to "4.6.2-api", to no effect. --- On Linux, Ubuntu 16.04

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 ZackSheppard · Nov 12, 2018 at 11:56 PM

I am bumping into this same issue. Putting the assemblies into my project has not done any good (though it allows me to build vs getting the exceptions). When I put the assemblies in it seems to build but is not working properly.

I built a library outside of unity in .NET Standard 4.6 and am trying to import it into unity (using Unity Editor 2017.3.0f3). I am able to play my game in editor perfectly fine, but when I try and build it is telling me that System.Runtime.dll could not be loaded in and fails my build

I would love some help getting this resolved :(. I feel like I should be able to make third party libraries and have them imported.

I would like to note that my library depends on a NuGet package that also has dependencies on System.Threading.Tasks.Extensions.dll and System.ValueTuple.dll. Since this was built outside of unity it is NOT using the mono specific versions in the %editor_install_path%\Unity\Editor\Data\MonoBleedingEdge\lib\mono\ directories. I suspect there is some confusion when unity is trying to resolve to it's own special flavors of these assemblies.

I will make sure and post if I find anything in particular. Going to try and see if this happens in the latest editor version in the meantime

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 ZackSheppard · Nov 13, 2018 at 10:20 PM 0
Share

I discovered some very strange things and ended up solving my problem. The summarized version of it is that my non-unity project was referencing a NuGet package that was dependent on System.Runtime.dll specifically for .net version 4.5 and I was trying to give it System.Runtime.dll from version 4.6 since I was building for that version. After I placed the unity (mono) versions of System.runtime.dll (and others) into a Plugins folder in my unity project, I was able to make and use builds.

Quick recap: 1) I am attempting to build a non-unity library in .NET 4.6 outside of my unity project and bring in the dlls for use inside unity 2017.3.0f3. 2) I was seeing an error about dlls that could not be used when building my project and this would fail my builds entirely 3) I had attempted to add the dlls unity complained about into my project (in plugins folder) with no luck. I was specifically trying to bring in the unity versions of assemblies from the %editor_install_path%\Unity\Editor\Data\$$anonymous$$onoBleedingEdge\lib\mono\ directory

I ended up looking through the dependencies of my library and targeted an inner dependency of the $$anonymous$$essagePack NuGet package. $$anonymous$$essagePack was dependent on System.Threading.Tasks.Extensions (NuGet package) and System.ValueTuple (NuGet package). Reviewing the NuGet page for System.Threading.Tasks.Extensions revealed that the dependency was for .NET version 4.5. I simply changed my .NET version for the project(s) to 4.5 and re-built and then added those assemblies to the project. I then grabbed the .NET version of System.Runtime.dll (and others that I discovered in my build logs) from %editor_install_path%\Unity\Editor\Data\$$anonymous$$onoBleedingEdge\lib\mono\4.5 and dropped em' into the plugins directory. Suddenly I COULD BUILD!!!

I think I had assumed that the dependency on System.Runtime.dll was due to my library root (which was previously .NET 4.6... so I assumed i needed to mono .NET 4.6 equivalent assemblies in unity) ins$$anonymous$$d of the lower version co$$anonymous$$g from the dependency chain in NuGet (which wanted the .NET 4.5 assemblies ins$$anonymous$$d). Glad I got this sorted.

I should also mention that I had this really silly bug in the editor where I would immediately get BadImageFormatExceptions (that were non-clearable and prevented compilation) when I would bring in the mono assemblies. I followed the stack and realized it was co$$anonymous$$g from the unityscript compiler. Just as a random test (because let's face it... who uses unityscript anymore?) I deleted all .js and .boo files from my project and that made the error go away. I was very surprised by this and am posting it in case it might help out.

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

71 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 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 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

Where does Unity5 look for native plugin dependencies in the editor on Windows? 1 Answer

Native Android plugin CPU subfolder approach not working 1 Answer

Game with Math.NET Numerics works fine on Windows, but not on OSX 1 Answer

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

Answered 1000 times, and still not solved - CommandInvokationFailure: Failed to re-package resources. 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