Search Unity

Build error with Unity 5.2

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

  1. van_ustwo

    van_ustwo

    Joined:
    Jul 10, 2012
    Posts:
    82
    I'm getting this error with building WSA universal 10 on Visual Studio Community.

    1> Running AssemblyConverter...
    1> System.IO.FileNotFoundException: Assembly "Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null" file not found.
    1> at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    1> at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name)
    1> at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    1> at Mono.Cecil.TypeReference.Resolve()
    1> at Unity.MetadataContainer.ResolveType(TypeReference type)
    1> at Unity.MetadataContainer.GetAssemblyForType(TypeReference type)
    1> at Unity.AssemblyWrapper.CreateMethodWrapper(MetadataContainer metadata, TypeWrapper typeWrapper, MethodDefinition method)
    1> at Unity.AssemblyWrapper.GetCallableMethods(TypeWrapper typeWrapper, TypeDefinition type, Boolean publicOnly)
    1> at Unity.AssemblyWrapper.AddType(TypeReference type)
    1> at Unity.GetTypesStep.Visit(TypeDefinition type)
    1> at Unity.TypeDefinitionDispatcher.DispatchType(TypeDefinition type)
    1> at Unity.TypeDefinitionDispatcher..ctor(ModuleDefinition module, ITypeDefinitionVisitor visitor)
    1> at Unity.GetTypesStep.ProcessModule()
    1> at Unity.ModuleStep.Execute()
    1> at Unity.Step.Execute(OperationContext operationContext, IStepContext previousStepContext)
    1> at Unity.Operation.Execute()
    1> at Unity.Program.Main(String[] args)
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Is that latest 5.2 build ?

    Do you have Visual Studio 2015 RTM installed ? Because the build won't work with Visual Studio 2015 RC installed.

    In Help->About, it should say 14.0.23107.0
     
  3. van_ustwo

    van_ustwo

    Joined:
    Jul 10, 2012
    Posts:
    82
    Yes. I'm using Unity 5.2.0f3.

    With
    Microsoft Visual Studio Community 2015
    Version 14.0.23107.0 D14REL
    Microsoft .NET Framework
    Version 4.6.00079

    Installed Version: Community

    Visual Basic 2015 00322-20000-00000-AA502
    Microsoft Visual Basic 2015

    Visual C# 2015 00322-20000-00000-AA502
    Microsoft Visual C# 2015

    Visual C++ 2015 00322-20000-00000-AA502
    Microsoft Visual C++ 2015

    Windows Phone SDK 8.0 - ENU 00322-20000-00000-AA502
    Windows Phone SDK 8.0 - ENU

    Visual Studio Tools for Universal Windows Apps 14.0.23121.00 D14OOB
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Could you please submit a bug report with repro case attached?

    Another idea, maybe you're using a plugin which was targeting Windows 8.1 SDK ?
     
  5. Thien-Le

    Thien-Le

    Joined:
    Jan 25, 2015
    Posts:
    30
    I created an empty project unity and wrote a simple plugin for windows universal like this link https://mix.office.com/watch/qqsyfebysgrj
    but a got a same error when build universal 10:
    UnityException: Failed to run assembly converter with command -metadata=0 -platform=uap -lock="project.lock.json" Temp\StagingArea\Assembly-CSharp.dll.
    System.IO.FileNotFoundException: Assembly "Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" file not found.
    at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name)
    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    at Mono.Cecil.TypeReference.Resolve()
    at Unity.ModuleContext.Retarget(TypeReference type, GenericContext context)
    at Unity.ModuleContext.Retarget(MethodReference method, GenericContext context)
    at Unity.FixReferencesStep.Visit(MethodDefinition method, GenericContext context)
    at Unity.FixReferencesStep.Visit(TypeDefinition type)
    at Unity.TypeDefinitionDispatcher.DispatchType(TypeDefinition type)
    at Unity.TypeDefinitionDispatcher..ctor(ModuleDefinition module, ITypeDefinitionVisitor visitor)
    at Unity.FixReferencesStep.ProcessModule()
    at Unity.ModuleStep.Execute()
    at Unity.FixReferencesStep.Execute()
    at Unity.Step.Execute(OperationContext operationContext, IStepContext previousStepContext)
    at Unity.Operation.Execute()
    at Unity.Program.Main(String[] args)

    PostProcessUAP.RunAssemblyConverterNoMetadata (System.String assembly, System.String projectLockFile) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessUAP.cs:57)
    PostProcessWinRT.RunReferenceRewriter () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:547)
    PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:118)
    UnityEditor.Metro.BuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:99)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
    UnityEditor.HostView:OnGUI()
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    It cannot find Test.dll. Are you sure you didn't mark it as "don't process"? Because you shouldn't.
     
  7. Thien-Le

    Thien-Le

    Joined:
    Jan 25, 2015
    Posts:
    30
    No, I don't mark "don't process"

    .
     

    Attached Files:

  8. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    433
    We are having the exact same problem. Any ideas? :)
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Could we get a bug report on this? I don't think we've been able to reproduce the issue internally yet. Is Test.dll present in <unityprojectdir>\temp\stagingarea when this error occurs? If not, could you try setting the plugin to "AnySDK" rather than UWP? Maybe there some kind of issue that prevents the DLL from getting copied.
     
    Thien-Le likes this.
  10. Thien-Le

    Thien-Le

    Joined:
    Jan 25, 2015
    Posts:
    30
    It worked. Thanks for your support :)
     
  11. Thien-Le

    Thien-Le

    Joined:
    Jan 25, 2015
    Posts:
    30
    Another problem. I added Facebook SDK in my plugin, but when building complete, I don't have Facebook.dll . And then I got this error when build Universal 10 in Unity:

    UnityException: Failed to run reference rewriter with command --target="Temp\StagingArea\TestPlugin.dll" --additionalreferences="Temp\StagingArea" --platform="C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd" --support="Temp\StagingArea\WinRTLegacy.dll" --supportpartialns=Unity.Partial --system=System --dbg=pdb --lock=project.lock.json --alt=System.Xml.Serialization;System.Collections,System.Collections.NonGeneric;System.Reflection,System.Reflection.TypeExtensions --ignore=System.IConvertible,mscorlib.
    Catastrophic failure while running rrw: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
    at Unity.ReferenceRewriter.SearchPathAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    at Unity.ReferenceRewriter.NuGetAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    at Mono.Cecil.TypeReference.Resolve()
    at Unity.ReferenceRewriter.RewriteTypeReferences.Visit(TypeReference type, String referencingEntityName)
    at Unity.ReferenceRewriter.ReferenceDispatcher.DispatchFields(TypeDefinition type, String referencingEntityName)
    at Unity.ReferenceRewriter.ReferenceDispatcher.Dispatch(TypeDefinition type)
    at Unity.ReferenceRewriter.ReferenceDispatcher.Dispatch()
    at Unity.ReferenceRewriter.RewriteTypeReferences.Run()
    at Unity.ReferenceRewriter.RewriteOperation.Execute(RewriteContext context)
    at Unity.ReferenceRewriter.Program.Main(String[] args)

    PostProcessWinRT.RunReferenceRewriter () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:543)
    PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:118)
    UnityEditor.Metro.BuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:99)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
    UnityEditor.HostView:OnGUI()
     
  12. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    433
    By the way, we're getting the same error as gamePig, where it says "System.IO.FileNotFoundException: Assembly "Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null" file not found."

    "Windows" isn't our plugin/assembly, is it? We've marked all our WSA plugins as "Any SDK", but it doesn't make a difference, because it's probably some internal assembly that isn't copied?
     
  13. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Windows assembly is a part of Window SDK, but I am not sure if it doesn't find Windows assembly from Windows 8.1 SDK or Windows 10 SDK, could we please get a bug report on this?
     
  14. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    433
    Done. Case number: 726816
     
  15. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    433
    It seems that the bug hasn't been tested yet, but even if you haven't seen the reproduction project, maybe you could give us some ideas, what we could try to work around the issue? We would greatly appreciate it! :)
     
    Last edited: Sep 15, 2015
  16. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Looking at the bug now, seems I can reproduce it with your repro case, stay tuned
     
  17. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    It really is a bug on our side, here's a workaround you can try:
    * Copy C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.wimd to your exported project directory, next to project.json, it should fix error where it doesn't find Windows.winmd.

    I still got errors after that related to your plugin, but it's up to you to fix those.

    Hope that helps
     
    MrEsquire likes this.
  18. Thien-Le

    Thien-Le

    Joined:
    Jan 25, 2015
    Posts:
    30
    I tried, but It still got the same error
     
  19. DominoOne

    DominoOne

    Joined:
    Apr 22, 2010
    Posts:
    433
    It worked for us, thank you very much!
     
  20. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Thien Le, please submit a bug with repro project attached, it maybe you're hitting a different bug. And post case number here
     
  21. Thien-Le

    Thien-Le

    Joined:
    Jan 25, 2015
    Posts:
    30
    Done. Case 728025
     
  22. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    As guessed, Thien you've bumped into a different bug... We'll try to fix it for 5.2p1 as well.

    Not sure about the workaround, the file which is not found is located here - C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0, you could try copying it to Unity project, but I am not sure that will help you.
     
  23. illuminat

    illuminat

    Joined:
    Jul 2, 2014
    Posts:
    40
    Hi,

    While building my wsa 10 test app, I get the following error:
    Running AssemblyConverter...
    System.IO.FileNotFoundException: Assembly "Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" file not found.

    the bug number would be 728098

    Thank you for looking into it.
     
  24. illuminat

    illuminat

    Joined:
    Jul 2, 2014
    Posts:
    40
    @Tomas1856 Have you had the time to look into my buildproblem?
     
  25. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    @illuminat the developer is still looking at it, but I am guessing you can apply similar workaround, by copying C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0\Windows.Foundation.UniversalApiContract.winmd to exported folder
     
  26. illuminat

    illuminat

    Joined:
    Jul 2, 2014
    Posts:
    40
    thanks, that worked!
     
  27. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    I'm having same problem as @Thien Le has. I have one Win10-Ads-Plugin.dll that is Universal and one "normal" dll that is the placeholder. My error looks as following when trying to build from Unity to a C# Project:

    Error building Player: UnityException: Failed to run assembly converter with command -metadata=0 -platform=uap -lock="project.lock.json" Temp\StagingArea\Assembly-CSharp.dll.
    System.IO.FileNotFoundException: Assembly "Win10-Ads-Plugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" file not found.
    vid Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    vid Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name)
    vid Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    vid Mono.Cecil.TypeReference.Resolve()
    vid Unity.ModuleContext.Retarget(TypeReference type, GenericContext context)
    vid Unity.ModuleContext.Retarget(MethodReference method, GenericContext context)
    vid Unity.FixReferencesStep.Visit(MethodDefinition method, GenericContext context)
    vid Unity.FixReferencesStep.Visit(TypeDefinition type)
    vid Unity.TypeDefinitionDispatcher.DispatchType(TypeDefinition type)
    vid Unity.TypeDefinitionDispatcher..ctor(ModuleDefinition module, ITypeDefinitionVisitor visitor)
    vid Unity.FixReferencesStep.ProcessModule()
    vid Unity.ModuleStep.Execute()
    vid Unity.FixReferencesStep.Execute()
    vid Unity.Step.Execute(OperationContext operationContext, IStepContext previousStepContext)
    vid Unity.Operation.Execute()
    vid Unity.Program.Main(String[] args)

    Tried changing the "SDK" to "Any SDK" as @Tautvydas suggested, but that didn't make a difference. Also, if you want me to submit a bug report, please link to where I can do that. I could only find the issue tracker, but couldn't find where to actually submit a bug report (not sure if I'm blind -.-). :/
     
  28. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    To submit a bug report, access menu Help->Report A Bug in Unity Editor. @Maisey your bug looks slightly different, because it complains about not able to find a plugin 'Win10-Ads-Plugin', while Thien Le's issue was about not finding system assembly.
     
  29. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    This does look like an AssemblyName mismatch. I'd suggest downloading ILSpy, popping the real (one meant for Windows 10) DLL to it and checking whether the name ("Win10-Ads-Plugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") matches exactly, including version, culture and public key token.
     
  30. illuminat

    illuminat

    Joined:
    Jul 2, 2014
    Posts:
    40
    I have another Problem. The Project runs in Debug and Release mode (until it crashes because it has not enough memory) on the WP10 device.

    However, if i choose the "master" configuration it builds without errors until the "computing application closure and generating interop code". There i get lots of warnings about "invalid IL detected". Here some examples:
    Then I get a warning about two not included Methods:
    If I try to start the build (on the phone and on the pc), it throws an exception: "The program '[9816] MyProgram.exe' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'."

    What could be missing here?

    Thank you for hints.
     
  31. noethis

    noethis

    Joined:
    Nov 11, 2013
    Posts:
    129
    Experiencing similar errors when trying to build a WSA project with my own custom plugin. Specifically missing both 'Windows.Foundation.UniversalApiContract' and 'Windows.Foundation.FoundationContract'. I went ahead and added the .winmd files as prescribed above to the Unity project--wasn't sure where to put them so threw them in the Extensions folder. It *seems* to have temporarily fixed it.
     
  32. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    @Tomas1856 This is one (of the many) errors that Thien Le had:

    UnityException: Failed to run assembly converter with command -metadata=0 -platform=uap -lock="project.lock.json" Temp\StagingArea\Assembly-CSharp.dll.
    System.IO.FileNotFoundException: Assembly "Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" file not found.
    at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name)
    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    at Mono.Cecil.TypeReference.Resolve()
    at Unity.ModuleContext.Retarget(TypeReference type, GenericContext context)
    at Unity.ModuleContext.Retarget(MethodReference method, GenericContext context)
    at Unity.FixReferencesStep.Visit(MethodDefinition method, GenericContext context)
    at Unity.FixReferencesStep.Visit(TypeDefinition type)
    at Unity.TypeDefinitionDispatcher.DispatchType(TypeDefinition type)
    at Unity.TypeDefinitionDispatcher..ctor(ModuleDefinition module, ITypeDefinitionVisitor visitor)
    at Unity.FixReferencesStep.ProcessModule()
    at Unity.ModuleStep.Execute()
    at Unity.FixReferencesStep.Execute()
    at Unity.Step.Execute(OperationContext operationContext, IStepContext previousStepContext)
    at Unity.Operation.Execute()
    at Unity.Program.Main(String[] args)


    Which looks exactly the same as mine except his plugin is named "Test" and mine is named "Win10-Ads-Plugin". I tried dropping both the DLLs into ILSpy (as suggest by @Tautvydas Zilys and this is the result:
    Win10-Ads-Plugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    and
    Win10-Ads-Plugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    The only thing that is different from them (that can be seen in ILSpy) is that the placeholder is built for AnyCPU while the Win10 one is built for x64. But this didn't seem to be the issue (after trying both).

    Thien Le seems to have solved his issue by choosing "Any SDK" but that didn't work for me. :/

    Thanks for your great support!

    EDIT: Something worth noting is that when I get this error there will be no C# Project files generated at all. HOWEVER, if I build it and make use of an enum that exists inside the DLL (also stubbed in the placeholder DLL). I will get an error saying the following:

    Reference Rewriter found some errors while running with command --target="Temp\StagingArea\Assembly-CSharp.dll" --additionalreferences="Temp\StagingArea","Temp\StagingArea\Plugins\X64" --platform="C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd" --support="Temp\StagingArea\WinRTLegacy.dll" --supportpartialns=Unity.Partial --system=System --dbg=pdb --lock=project.lock.json --alt=System.Xml.Serialization;System.Collections,System.Collections.NonGeneric;System.Reflection,System.Reflection.TypeExtensions --ignore=System.IConvertible,mscorlib.
    Error: type `ACE.Ads.Plugin.UniversalWin10.HorizontalAlignment` doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Void WindowsAdProvider::OnInitialize(ACE.Ads.AdProviderSettings).
    Error: type `ACE.Ads.Plugin.UniversalWin10.VerticalAlignment` doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Void WindowsAdProvider::OnInitialize(ACE.Ads.AdProviderSettings).
    Error: type `ACE.Ads.Plugin.UniversalWin10.HorizontalAlignment` doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Void WindowsAdProvider::OnInitialize(ACE.Ads.AdProviderSettings).
    Error: type `ACE.Ads.Plugin.UniversalWin10.VerticalAlignment` doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Void WindowsAdProvider::OnInitialize(ACE.Ads.AdProviderSettings).
    Error: method `System.Void ACE.Ads.Plugin.UniversalWin10.BannerAd::.ctor(System.Int32,System.Int32,ACE.Ads.Plugin.UniversalWin10.HorizontalAlignment,ACE.Ads.Plugin.UniversalWin10.VerticalAlignment,System.String,System.String)` doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Void WindowsAdProvider::OnInitialize(ACE.Ads.AdProviderSettings).


    But Unity will actually go through with the build and there will now be a C# project. If it works or not I'm not sure.

    I've made a repro case and submitted the bug (see Case 729784).
     
    Last edited: Sep 23, 2015
  33. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Sorry to bump this but can I get some feedback regarding this and maybe a work-around until it's fixed?

    @Tomas1856 , @Tautvydas Zilys ?
     
  34. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Thien-Le likes this.
  35. kosyakow

    kosyakow

    Joined:
    Apr 1, 2015
    Posts:
    5
    Hi @Tomas1856 i have simular problem when build UWP app.
    Visual studio build log:
    Copying unprocessed assemblies...
    1> Running AssemblyConverter...
    1> System.IO.FileNotFoundException: Assembly "Windows.Foundation.FoundationContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" file not found.
    ...
    If i copy 'Windows.Foundation.UniversalApiContract' and 'Windows.Foundation.FoundationContract' winmd files to project, AssemblyConverter works but in compile i have 14k+ errors (APPX1706 and APPX1704) and 2 warning APPX1704.
    What i made wrong?
     
  36. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Is that with 5.2.1p1?
     
  37. kosyakow

    kosyakow

    Joined:
    Apr 1, 2015
    Posts:
    5
    Sorry. In 5.2.1f1. Will try use patch
     
  38. kosyakow

    kosyakow

    Joined:
    Apr 1, 2015
    Posts:
    5
  39. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Bug report please with repro project attached
     
  40. kosyakow

    kosyakow

    Joined:
    Apr 1, 2015
    Posts:
    5
  41. Thien-Le

    Thien-Le

    Joined:
    Jan 25, 2015
    Posts:
    30
  42. Aghajani

    Aghajani

    Joined:
    Sep 27, 2015
    Posts:
    4
    When I use some C# script like this in one of my script files:

    using UnityEngine;
    using System.Collections;
    #if !UNITY_EDITOR && WINDOWS_UWP
    using Windows.Data.Json;
    #endif

    public class Main : MonoBehaviour {

    // Use this for initialization
    void Start () {
    #if !UNITY_EDITOR && WINDOWS_UWP
    JsonObject a;
    #endif
    }

    // Update is called once per frame
    void Update () {

    }
    }


    the build action will raise this error (and no C# project is generated):
    Assets\Main.cs(12,9): error CS0433: The type 'JsonObject' 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'

    I have tested this in a complete new project using 5.2.1p1 and VS2015RTM

    After some researches (same problem in C# community), it seems Unity is trying to target both Windows8.1 SDK and Windows10 SDK while building (why and how, I don't know)
     
  43. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    We know about this problem, as temporary workaround, do this:
    * Go to C:\Program Files (x86)\Windows Kits\10\UnionMetadata backup Windows.winmd there
    * Copy C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Facade\Windows.winmd over to C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
     
  44. Aghajani

    Aghajani

    Joined:
    Sep 27, 2015
    Posts:
    4
    Your workaround for the new project worked successfully.
    However in my main project caused the building passes 'Compiling Scripts' but in 'stage two' it raises this exception:

    UnityException: Failed to run assembly converter with command -metadata=0 -platform=uap -lock="UWP\project.lock.json" Temp\StagingArea\Sockets.Plugin.Unity.WindowsUniversal.dll -path="Temp\StagingArea".
    System.IO.FileNotFoundException: Assembly "Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" file not found.
    at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name)
    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    at Mono.Cecil.TypeReference.Resolve()
    at Unity.ModuleContext.Retarget(TypeReference type, GenericContext context)
    at Unity.FixReferencesStep.Visit(TypeDefinition type)
    at Unity.TypeDefinitionDispatcher.DispatchType(TypeDefinition type)
    at Unity.TypeDefinitionDispatcher..ctor(ModuleDefinition module, ITypeDefinitionVisitor visitor)
    at Unity.FixReferencesStep.ProcessModule()
    at Unity.ModuleStep.Execute()
    at Unity.FixReferencesStep.Execute()
    at Unity.Step.Execute(OperationContext operationContext, IStepContext previousStepContext)
    at Unity.Operation.Execute()
    at Unity.Program.Main(String[] args)

    PostProcessUAP.RunAssemblyConverterNoMetadata (System.String assembly, System.String projectLockFile) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessUAP.cs:69)
    PostProcessWinRT.RunReferenceRewriter () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:547)
    PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:118)
    UnityEditor.Metro.BuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:99)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
    UnityEditor.HostView:OnGUI()

    the 'Sockets.Plugin.Unity.WindowsUniversal.dll' is a portable class library I have been used before in my Windows Universal 8.1 export (with no problem)
    can't we use Portable Class Library dlls in UniversalWindows10 export?
     
  45. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Can we get a bug report with repro project, please. We're trying to catch all these corner cases.
     
  46. Aghajani

    Aghajani

    Joined:
    Sep 27, 2015
    Posts:
    4
    I don't know what you mean by bug report, but I have uploaded the sample repro project (containing the bug on export) in this address: (your server don't allowed to upload this file directly here):
    http://s000.tinyupload.com/index.php?file_id=88229449669184841312

    UPDATE:
    I have recompiled all my dlls (plugins for WSA) to use 'Windows Universal Class Library' template in VS2015 and replaced the new compiled dlls with old ones (PCL s)
    Now, with the workaround you proposed earlier, the C# projects are created successfully. But when I try to build the exported project in VS2015, I receive this error:

    error MSB3073: The command ""D:\Source\SkywaveVSOnline\YB\Unity\UWP\Unity\Tools\AssemblyConverter.exe" -platform=uap -lock="D:\Source\SkywaveVSOnline\YB\Unity\UWP\YB\project.lock.json" -bits=32 -path="." -path="..\Players\UAP\x86\Debug" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\Assembly-CSharp\bin\x86\Debug\Assembly-CSharp.dll" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\Assembly-CSharp-firstpass\bin\x86\Debug\Assembly-CSharp-firstpass.dll" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\YB\UnityEngine.dll" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\YB\UnityEngine.UI.dll" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\YB\Sockets.Plugin.Unity.UWP.dll" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\YB\wp-store.dll" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\YB\soomla-wp-core.dll" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\YB\RestSharp.WindowsUWP.dll" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\YB\UnityEngine.Networking.dll" "D:\Source\SkywaveVSOnline\YB\Unity\UWP\YB\Skywave.Unity.UWP.dll"" exited with code 1.

    also I have tried to run the command manually and here is the output from command line:

    System.IO.FileNotFoundException: Assembly "Windows.Foundation.UniversalApiContra
    ct, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" file not found.
    at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParame
    ters parameters)
    at Unity.UWPAssemblyResolver.Resolve(AssemblyNameReference name)
    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    at Mono.Cecil.TypeReference.Resolve()
    at Unity.MetadataContainer.ResolveType(TypeReference type)
    at Unity.MetadataContainer.GetAssemblyForType(TypeReference type)
    at Unity.AssemblyWrapper.CreateMethodWrapper(MetadataContainer metadata, Type
    Wrapper typeWrapper, MethodDefinition method)
    at Unity.AssemblyWrapper.GetCallableMethods(TypeWrapper typeWrapper, TypeDefi
    nition type, Boolean publicOnly)
    at Unity.AssemblyWrapper.AddType(TypeReference type)
    at Unity.GetTypesStep.Visit(TypeDefinition type)
    at Unity.TypeDefinitionDispatcher.DispatchType(TypeDefinition type)
    at Unity.TypeDefinitionDispatcher..ctor(ModuleDefinition module, ITypeDefinit
    ionVisitor visitor)
    at Unity.GetTypesStep.ProcessModule()
    at Unity.ModuleStep.Execute()
    at Unity.Step.Execute(OperationContext operationContext, IStepContext previou
    sStepContext)
    at Unity.Operation.Execute()
    at Unity.Program.Main(String[] args)
     
    Last edited: Sep 27, 2015
  47. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
  48. Aghajani

    Aghajani

    Joined:
    Sep 27, 2015
    Posts:
    4
    Oh, OK! Should I create a bug report now?
     
  49. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    Yes, please, and attach a repro project if possible.
     
  50. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Have now tested the build and it didn't solve my issue. So please take a look at my bug report and repro case. The only workaround I can find is that while Unity is building the files i manually copy the DLL to the tempstaging folder (right after the folder has been cleaned by Unity).