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

[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,644
    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,722
    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,644
    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,644
    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,644
    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.