Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

[Universal 10] The type 'X' exists in both 'Windows.Foundation.UniversalApiContract' and 'Windows'

Discussion in 'Windows' started by Shiaku, Feb 3, 2016.

  1. Shiaku

    Shiaku

    Joined:
    Jan 8, 2015
    Posts:
    7
    I've been trying to port a game to Windows Universal 10 (UAP) for couple days, but haven't been able to solve the error I'm getting when I'm still compiling scripts during build.

    Assets\Analytics\Scripts\Platform-WindowsStore\File.cs(84,30): error CS0433: The type 'StorageFile' exists in both 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' and 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'

    Assets\Analytics\Scripts\Platform-WindowsStore\File.cs(97,60): error CS0433: The type 'CreationCollisionOption' exists in both 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' and 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'
    The script in case is used by the Google Universal Analytics plugin, although it also happens with GameAnalytics (not the exact same types, but same error).

    I've been looking for some solutions, but haven't been able to find much. I'm using Unity 5.3.2p1 (tried with 5.3.1f1 and 5.3.1p4 before and it didn't help) and I've got Windows 10 RTM and Microsoft Emulator for Windows 10 mobile.

    I've been through these posts:
    http://forum.unity3d.com/threads/warning-do-not-update-to-windows-sdk-10-0-10586-0-just-yet.371074/
    http://forum.unity3d.com/threads/winrtlegacy-conflicts.353841/

    And according to this post, the problem is that the compiler can't choose which .dll he should be using (which is strange, since when I use Windows.StorageFile it says it doesn't exist on the library, and when I use Windows.Foundation.UniversalApiContract.StorageFile, it says the UniversalApiContract doesn't exist in the library).

    I would really appreciate some help.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,756
    That's a weird error: could you post your editor log?
     
  3. Shiaku

    Shiaku

    Joined:
    Jan 8, 2015
    Posts:
    7
    For sure!
    (Sorry for the slow reply)
     

    Attached Files:

  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,783
    StorageFile class is in Windows.Storage namespace. The errors are about assemblies, not namespace. Can you try using Windows.Storage.StorageFile. Also, cau you paste a piece of code that causes this issue?
     
  5. Shiaku

    Shiaku

    Joined:
    Jan 8, 2015
    Posts:
    7
    No problem.

     
    Last edited: Feb 4, 2016
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,756
    I cannot reproduce what you're seeing - that script compiles and builds for Universal 10 SDK just fine on my machine on 5.3.2p1.

    The editor.log says that the only windows.winmd that is referenced is "C:\Windows Kits\10\UnionMetadata\Facade\Windows.winmd". The error says that StorageFile is defined in that assembly, however, that WinMD file should not define any types at all (it has no types inside on my machine). On my machine, that file is 170 KB. How big is it on yours?
     
  7. Shiaku

    Shiaku

    Joined:
    Jan 8, 2015
    Posts:
    7
    My Windows.winmd is 3.69Mb O-o.

    That's a huge difference. Perhaps you could send me yours so I can try building with it?
     
    Last edited: Feb 5, 2016
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,756
    PMed. If it works, you should consider SDK reinstall, as something is messed up.
     
  9. Shiaku

    Shiaku

    Joined:
    Jan 8, 2015
    Posts:
    7
    I was able to build the project, although VS doesn't recognize the Universal Windows Platform Tools and Windows 10 SDK 10.0.10240 (even though I re-installed it like 3 times), so I still can't build it on the device.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,756
    I'd suggest nuking VS2015 and reinstalling it cleanly.
     
  11. Shiaku

    Shiaku

    Joined:
    Jan 8, 2015
    Posts:
    7
    I'm going to try that now.