Search Unity

Build error with Unity 5.2

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

  1. Thien-Le

    Thien-Le

    Joined:
    Jan 25, 2015
    Posts:
    30
    I have another error (Unity 5.2.1p1). When I run project, I got this error :
    System.IO.FileNotFoundException: Assembly "Windows.Foundation.FoundationContract, Version=1.0.0.0, 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)

    I copied Windows.Foundation.FoundationContract.winmd to project folder, but another error appeared:
    "
    ...The use of the Windows namespace is reserved.
    ...error APPX1706: The .winmd file 'Windows.Foundation.FoundationContract.winmd' contains type 'Windows.Foundation.HResult' outside its root namespace 'Windows.Foundation.FoundationContract'. Make sure that all public types appear under a common root namespace that matches the output file name.
    ...error APPX1704: The .winmd file 'Windows.Foundation.FoundationContract.winmd' contains type 'Windows.Foundation.Size'. The use of the Windows namespace is reserved.
    ...error APPX1706: The .winmd file 'Windows.Foundation.FoundationContract.winmd' contains type 'Windows.Foundation.Size' outside its root namespace 'Windows.Foundation.FoundationContract'. Make sure that all public types appear under a common root namespace that matches the output file name.
    ...error APPX1704: The .winmd file 'Windows.Foundation.FoundationContract.winmd' contains type 'Windows.Foundation.FoundationContract'. The use of the Windows namespace is reserved.
    1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1673,5): error APPX1706: The .winmd file 'Windows.Foundation.FoundationContract.winmd' contains type 'Windows.Foundation.FoundationContract' outside its root namespace 'Windows.Foundation.FoundationContract'. Make sure that all public types appear under a common root namespace that matches the output file name.
    .............................
    "

    Ah, I have a same problem with @kosyakow
     
  2. kosyakow

    kosyakow

    Joined:
    Apr 1, 2015
    Posts:
    5
    Hi @Thien Le. Let me know if you solve the problem.
     
    Thien-Le likes this.
  3. WilloWisp

    WilloWisp

    Joined:
    Apr 13, 2014
    Posts:
    8
    I get the same errors still, with Unity 5.2.1p1, where AssemblyConverter cannot find Windows.Foundation.FoundationContract and Windows.Foundation.UniversalApiContract. Adding them to the root of the generated UWP app project gives me a lot of new errors like below.

    Come on now, this is ridiculous. You have been stating to support Windows 10 UWP apps since 5.2, several weeks ago, and still it is not possible to build against it. We have to wait at least a week for each patch to turn up, and every patch fixes single issues but not all. How long before we can build for the UWP platform? We have a release in two weeks!

    error APPX1706: The .winmd file 'Windows.Foundation.FoundationContract.winmd' contains type 'Windows.Foundation.FoundationContract' outside its root namespace 'Windows.Foundation.FoundationContract'
     
  4. WilloWisp

    WilloWisp

    Joined:
    Apr 13, 2014
    Posts:
    8
    Setting Don't Process on my Windows 10 UWP Plugin makes it build in Visual Studio 2015, since the AssemblyConverter no longer porcesses the DLL. Is this fine as a workaround?

    The UWP plugin only contains references to Mobile and Desktop Extensions for UWP and Newtonsoft.Json as NuGet package.

    The documentation states that it is only okay when plugin does not contain serializable classes.

    (Only applies for managed assemblies) Disables patching for this assembly. Patching is needed when assemblies contains classes serializable by Unity. In these cases, additional IL code is injected into the assemblies. If you know that assemblies doesn’t have such classes then it’s safe to disable the patching. Note: if the assembly isn’t patched and Unity tries to serialize at runtime, you’ll get an ‘Out of bounds’ error or something similar.
     
  5. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    So, can we get a confirmation if the issues have been resolved in the p2-patch? Couldn't find my or anyone else's bug mentioned in the patch-notes.

    Thanks!

    @Tautvydas Zilys
     
  6. Thien-Le

    Thien-Le

    Joined:
    Jan 25, 2015
    Posts:
    30
    Yeah, It worked. Thank you very much :D
    Our problem solved with p2-patch.
    @kosyakow
     
  7. cadahl

    cadahl

    Joined:
    Feb 27, 2014
    Posts:
    3
    @Maisey Did your problem get solved? I have the same issue it seems. The placeholder DLL is Any CPU, and the UWP versions are platform specific (ARM, x86, x64).
     
  8. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    @cadahl I haven't tried the latest patch yet (It's not a crucial issue for me at the moment since I'm just testing stuff) but the workaround I had works (copy the .DLL to the temp/stagingarea folder right after Unity cleans the folder). Tell me if you try the latest Unity version and if it works or not. :)
     
  9. cadahl

    cadahl

    Joined:
    Feb 27, 2014
    Posts:
    3
    @Maisey Thanks. So you do this step using msbuild?

    I encountered the problem on 5.2.1p2 which should be the latest patch release.
     
  10. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    @cadahl I actually do it manually since I don't create a new build very often. But you should be able to do it by writing an editor script.
     
  11. cadahl

    cadahl

    Joined:
    Feb 27, 2014
    Posts:
    3
    @Maisey Ended up working around it, by not directly referencing the native DLL from the Any CPU assembly (using P/Invoke to load the native DLL instead). Then Unity does the right thing with the x86/x64/ARM folders.
     
  12. aakash_kishan

    aakash_kishan

    Joined:
    Mar 3, 2017
    Posts:
    2
    I'm fairly new to Unity.
    I have gotten a similar kind of Error trying to build a project for Unity C#.
    The Error Message I received is :
    UnityException: Failed to run reference rewriter with command --target="Temp\StagingArea\UnityEngine.UI.dll" --additionalreferences="Temp\StagingArea" --platform="UnionMetadata\Facade\Windows.winmd" --support="Temp\StagingArea\WinRTLegacy.dll" --supportpartialns=Unity.Partial --system=System --dbg=pdb --lock=UWP\project.lock.json

    Thank you for helping me with this
     
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    @aakash_kishan, can you create a new thread about this? Your error isn't likely to be related to the one this thread was made for. Also, please paste the editor log contents in there too.
     
  14. aakash_kishan

    aakash_kishan

    Joined:
    Mar 3, 2017
    Posts:
    2
    Sure, Thanks man