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. Dismiss Notice

Error building Player: Extracting referenced dlls failed.

Discussion in 'Windows' started by Lars-Blaabjerg, Aug 19, 2015.

  1. Lars-Blaabjerg

    Lars-Blaabjerg

    Joined:
    Apr 5, 2011
    Posts:
    54
    Hi,

    I just updated to Unity 5 and was trying to build my project for Windows Phone 8. I had the following error:

    "ArgumentException: The Assembly mscorlib.Extensions is referenced by UnityUtilitiesWP8 ('Assets/Plugins/WP8/UnityUtilitiesWP8.dll'). But the dll is not allowed to be included or could not be found."

    Followed by

    "Error building Player: Extracting referenced dlls failed."

    error.PNG

    The library is built as a "Windows Phone Class Library" targetting Windows Phone 8.0 and is not depending on any third party libraries, only the standard libraries. I have made a stub library as a normal "Class Library" using .NET Framework 3.5, which is used when not on windows phone.

    I noticed there is a bunch of settings for files in the plugins folder now.

    I have tried the following:

    Initially both my stub and the real dll would be included. This failed to build with the message "Plugins colliding with each other.". Apparently the one in the plugins/WP8 folder will not overwrite the one in the plugins folder automatically anymore.

    Then I tried unchecking the "Any Platform" checkbox for both dlls and checking just WP8Player for the real dll and all the others for the stub dll. This failed to build because of compiler errors. It couldn't find the classes defined in the dlls. As if, at compile time, none of the dlls were there.

    Then I noticed the "Placeholder" input for the WP8 library. I set this to point at stub dll. Now it fails with the message "Error building Player: Extracting referenced dlls failed."

    The "Don't process" checkbox doesn't seem to make any difference.

    The settings look like this now:

    Real WP8 DLL:
    realdll.PNG
    Stub DLL:
    stubdll.PNG

    I am using Unity 5.1.2p3, DLL assemblies are made with Visual Studio 2013.

    TL;DR I am currently unable to build for windows phone. What am I doing wrong? Is this a bug?

    Thanks
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    Your plugin is referencing mscorlib.Extensions.dll, it should only reference mscorlib. Does that hint you in any way?
     
  3. Lars-Blaabjerg

    Lars-Blaabjerg

    Joined:
    Apr 5, 2011
    Posts:
    54
    Maybe I wasn't clear about the plugin working fine before updating Unity?

    I have not added any references to the plugin, so it is not referencing anything that is not included in the standard platform library.

    Why does Unity not allow me to use that dll? Arbitrary limitations like this makes it rather cumbersome to write plugins because you must have a list of what you can/cannot use from the standard platform library.
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
  5. Lars-Blaabjerg

    Lars-Blaabjerg

    Joined:
    Apr 5, 2011
    Posts:
    54
    Would you care to elaborate on that? How do I chose NOT to compile against Silverlight? I'm not even sure what it is or why it is wrong. When creating a project it looks like this: newproject.PNG

    And the project looks like this:
    project.PNG

    I see a SILVERLIGHT compilation symbol in the project properties, but removing that and rebuilding the plugin does not remove the error.

    I have found the class in the offending assemnbly that I am using: System.Security.Cryptography.ProtectedData, and according to MS docs, it is supported on the platform. So my question remains: Why is Unity not allowing me to use it anymore?
     
  6. Lars-Blaabjerg

    Lars-Blaabjerg

    Joined:
    Apr 5, 2011
    Posts:
    54
    The thread you linked to does not provide answers to any of my questions, and does not solve the problem. I am building for Windows Phone 8!
     
  7. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    It seems Unity doesn't know how to locate mscorlib.extensions, so it's really is a bug, as workaround you could do the following:
    * Option A
    - Remove UnityUtilitiesWP8 from Unity project to some other place outside, and reference that plugin from exported solution

    * Option B
    - Copy mscorlib.extensions from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0 and place it next to your plugin, and mark it as WP8 plugin


    Also please submit a bug with repro project attached, sorry for inconvience.
     
  8. Lars-Blaabjerg

    Lars-Blaabjerg

    Joined:
    Apr 5, 2011
    Posts:
    54
    Thanks for that acknowledgement, I will create a repro project and a bug report.

    Also thanks for the suggestions, option B actually worked for me as a workaround.
     
  9. Lars-Blaabjerg

    Lars-Blaabjerg

    Joined:
    Apr 5, 2011
    Posts:
    54
    I was a little too quick to say that the workaround worked. It compiled, but didn't work. Probably because it was using the stub dll instead of the real platform one.

    I opted to rewrite the code to not use the ProtectedData class.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,504
    You should be able to delete the DLL after Unity builds the project, so it doesn't deploy it when you build it in visual studio.
     
  11. Lars-Blaabjerg

    Lars-Blaabjerg

    Joined:
    Apr 5, 2011
    Posts:
    54
    I thought so too, but an exception is thrown if I do that:

    System.TypeInitializationException was unhandled by user code
    HResult=-2146233036
    Message=The type initializer for 'WinRTBridge.WinRTBridge' threw an exception.
    Source=WinRTBridge
    TypeName=WinRTBridge.WinRTBridge
    StackTrace:
    at WinRTBridge.WinRTBridge.set_Control(Object value)
    at WP8Bug.MainPage..ctor()
    InnerException: System.TypeInitializationException
    HResult=-2146233036
    Message=The type initializer for 'WinRTBridge.TypeInformation' threw an exception.
    Source=WinRTBridge
    TypeName=WinRTBridge.TypeInformation
    StackTrace:
    at WinRTBridge.TypeInformation..ctor()
    at WinRTBridge.WinRTBridge..cctor()
    InnerException: System.IO.FileNotFoundException
    HResult=-2147024894
    Message=Could not load file or assembly 'mscorlib.Extensions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    Source=UnityEngine
    FileName=mscorlib.Extensions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=null
    StackTrace:
    at UnityEngineInternal.BootstrapHelpers.FillTypeMaps(Dictionary`2& typeToTypeIdMap, List`1& typeIdToTypeMap)
    at WinRTBridge.TypeInformation..cctor()
    InnerException:
     
  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,504
    Ah, you're right, it won't work..