Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

unity5.0.1 WP8 mscorlib.Extensions is not allowed to be included or could not be found.

Discussion in 'Windows' started by QingFeng-Zhou, May 5, 2015.

  1. QingFeng-Zhou

    QingFeng-Zhou

    Joined:
    Dec 22, 2014
    Posts:
    20
    ArgumentException: The Assembly mscorlib.Extensions is referenced by WP8NativeAPI ('Assets/Plugins/WP8/WP8NativeAPI.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 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:154)
    UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:192)
    UnityEditor.HostView:OnGUI()
     
  2. QingFeng-Zhou

    QingFeng-Zhou

    Joined:
    Dec 22, 2014
    Posts:
    20
    copy mscorlib.extensions.dll file to Plugins\WP8 folder, build success.
     
  3. thelightofwinter

    thelightofwinter

    Joined:
    Dec 10, 2014
    Posts:
    8
    build success, but exception when run:
    Exception could not load file or assembly mscorlid.extensions...
    Any idea to solve it? Thanks a lot
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,642
    If you copied mscorlib.extensions.dll to plugins, you should also set it "Unprocessed" for the very least.
     
  5. thelightofwinter

    thelightofwinter

    Joined:
    Dec 10, 2014
    Posts:
    8
    I copy mscorlib.extensions.dll to Plugins\WP8 folder, and set it to "Unprocessed"
    Build success, but I still get exception when run the program
     
  6. thelightofwinter

    thelightofwinter

    Joined:
    Dec 10, 2014
    Posts:
    8
    copy mscorlib.extensions.dll file to Plugins\WP8 folder, build success.
    When run the program on windows phone 8.1, I receive this exception:

    Exception: Could not load file or assembly mscorlid.Extensions, version=2.0.5.0, culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified...

    In console of unity, I receives this message:

    SpritePacker failed to get types from mscorlib.Extensions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e. Error: The classes in the module cannot be loaded.
    UnityEditor.HostView:OnGUI()

    Can anyone help me?
     
  7. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,672
    If you're building for Windows Phone 8.1, you have to have a plugin compiled for Windows Phone 8.1, but apparently your plugin is compiled for Windows Phone 8?
     
  8. thelightofwinter

    thelightofwinter

    Joined:
    Dec 10, 2014
    Posts:
    8
    Thanks for your reply. I recompiled my plugin for Windows Phone 8.1. I still received the same exception.
    Any suggestion to solve it? Thanks.
     
  9. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,642
    Where are you taking this mscorlib.Extensions.dll from? You should take it from WP8.1 SDK.
    Also, the problem might be that this dll is copied by Unity into your solution, try removing it from there and adding as a reference to generated solution.
     
  10. thelightofwinter

    thelightofwinter

    Joined:
    Dec 10, 2014
    Posts:
    8
    I take mscorlib.Extensions.dll from
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.1\

    When I use Unity 4.6.7 to compile my game with myplugin.dll, my game run ok.
    When I use any version Unity 5.x to compile my game with myplugin.dll, my game run with Exception "Could not load file or assembly mscorlid.Extensions"
    So, the problem might be the change in the way that Unity 5.x and Unity 4.6 compile plugins.

    Could you please explain a little bit more detail how to remove it and add as a reference?
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,507
    It kinda makes sense that it doesn't work.. reference assemblies don't have any code on them, and they are not meant to be executed. They're meant to just be referenced when you're building your code. Furthermore, mscorlib.extensions.dll is not available on Windows Phone 8.1 API targeted by Unity (also known as .NET for Windows Runtime apps subset), and only available in the silverlight subset. What are you using from that DLL that you need it on WP8.1?
     
  12. thelightofwinter

    thelightofwinter

    Joined:
    Dec 10, 2014
    Posts:
    8
    I remove all functions of mscorlib.extensions.dll that I used. Now, the game did not show exceptions. But the game does not run ok.

    I might go back Unity 4.6.7. When I compile the game by Unity 4.6.7, the game run ok.
     
  13. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,672
    Well, you haven't answered the question, what classes/functions from mscorlib.extensions.dll are you using? :)
     
  14. thelightofwinter

    thelightofwinter

    Joined:
    Dec 10, 2014
    Posts:
    8
    Hi, I used System.Security.Cryptography.*
     
  15. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,642
    So yes, these probably aren't available on WSA, you can check the Microsoft documentation for that.
    We parovide replacements for some of them in WinRTLegacy, which ones are you using?