Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 5.2 Universal 10 Build Bug?

Discussion in 'Windows' started by webbut, Sep 9, 2015.

  1. webbut

    webbut

    Joined:
    Jun 25, 2014
    Posts:
    20
    I've been trying to get a Windows 10 UAP build of our game working which uses some of the XML classes found in System.XML. The game runs fine in editor with no errors but when I go to make a Windows Universal 10 XAML build I get this error:

    The type 'XmlDocument' exists in both 'System.Xml.XmlDocument, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'WinRTLegacy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

    Is there anyway to work around this?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,645
    It's a known bug that will be fixed in the first 5.2 patch release.

    This happens due to the fact that these APIs weren't available on Windows 8.1, so we've implemented them ourselves. However, Microsoft added them back with Windows 10.

    The only workaround I can offer is to compile the offending code to a separate DLL and drop it into your project.
     
  3. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    433
    If you don't have a lot of code that uses these conflicting classes, you could make this workaround:

    1. Build an empty Unity project for Windows 10, find WinRTLegacy.dll in the built Visual Studio project.
    2. Drop WinRTLegacy.dll into your normal Unity project (Plugins/WSA/). Mark it as "don't process" in Unity.
    3. Add a file named csc.rsp directly in your Assets folder and put this line in it: /reference:WinRTLegacyTMP=Assets/Plugins/WSA/WinRTLegacy.dll
    4. In scripts that use conflicting classes, at the very top, add:

    #if NETFX_CORE
    extern alias WinRTLegacyTMP;
    #endif

    5. In each file that uses conflicting classes for every conflicting class, also add these after other "using" statements:

    #if NETFX_CORE
    using ConflictingClassName = WinRTLegacyTMP::Full.Namespace.ConflictingClassName;
    #endif

    It's not pretty, but if you need to build it and cannot wait for the fix, it's better than nothing.
     
  4. AirBiscuit

    AirBiscuit

    Joined:
    Aug 16, 2014
    Posts:
    5
    What do you make of this one? I'm using VS2015 that came installed with 5.2 (But it wasn't in the list of script editors so I had to browse for it, if that the problem?)


    Could not start compilationException: 'UnionMetadata\Windows.winmd' not found, do you have Windows UAP SDK installed?
    UnityEditor.Scripting.Compilers.MicrosoftCSharpCompiler.FillNETCoreCompilerOptions (WSASDK wsaSDK, System.Collections.Generic.List`1 arguments, System.String& argsPrefix) (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/MicrosoftCSharpCompiler.cs:184)
    UnityEditor.Scripting.Compilers.MicrosoftCSharpCompiler.StartCompiler () (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/MicrosoftCSharpCompiler.cs:291)
    UnityEditor.Scripting.Compilers.ScriptCompilerBase.BeginCompiling () (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/ScriptCompilerBase.cs:47)
    UnityEditor.HostView:OnGUI()
     
  5. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875
    Try to create Universal Windows App from Visual Studio 2015, probably it doesn't contain the required addon.
     
    AirBiscuit likes this.
  6. AirBiscuit

    AirBiscuit

    Joined:
    Aug 16, 2014
    Posts:
    5
    That was it, thanks
     
  7. webbut

    webbut

    Joined:
    Jun 25, 2014
    Posts:
    20
    Thanks for the info and workarounds, is there a release date or window for the first 5.2 patch?
     
  8. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    433
    On another thread they said that maybe on 2015-09-21.
     
  9. HandMadeGame

    HandMadeGame

    Joined:
    Oct 27, 2010
    Posts:
    11
    Hello there, I have the same issue with AirBiscuit building from Unity 5.2.1f1 for Windows Universal 10.

    How do you mean by the quoted solution? How can I create Universal Windows App from Visual Studio 2015?

    I have opened VS2015 project file, press Start (build), and then I get this message.

    A project with an Output Type of Class Library cannot be started directly.

    In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.


    Thanks!
     
  10. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875