I’m trying to build to Win10 from Unity 5.2f3 and keep running into issues with .NET types that have been duplicated in WinRTLegacy (e.g. XmlDocument, System.IO.Directory/File):
error CS0433: The type 'Directory' exists in both 'System.IO.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'WinRTLegacy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
I’ve tried a bunch of variants of the suggested fix below, but haven’t gotten anything to play nicely when I actually build. I admit I don’t fully understand how ‘usings’ work.
#if NETFX_CORE
using IO = WinRTLegacy.System.IO;
#else
using IO = System.IO;
#endif
error CS0433: The type'File' exists in both 'System.IO.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'WinRTLegacy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
With DominoOne solution the error disappeared, but I got new error: error CS0234: The type or namespace name 'Full' does not exist in the namespace 'WinRTLegacyTMP' (are you missing an assembly reference?)
Thanks for the quick response
But now the old error popped back and got new error:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
The following assembly referenced from C:\YYY\Assets\Plugins\WSA\WinRTLegacy.dll could not be loaded:
Assembly: System.Runtime (assemblyref_index=0)
Version: 4.0.20.0
Public Key: b03f5f7f11d50a3a
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (C:\YYY\Assets\Plugins\WSA\).
Could not load file or assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Missing method .ctor in assembly C:\YYY\Assets\Plugins\WSA\WinRTLegacy.dll, type System.Runtime.Versioning.TargetFrameworkAttribute
Can't find custom attr constructor image: C:\YYY\Assets\Plugins\WSA\WinRTLegacy.dll mtoken:
Yes, thanks, that caused that Unhandled Exception error, but the original error unfortunately appears anyway
Assets\Scripts\AssetStreamer.cs(28,22): error CS0433: The type 'File' exists in both 'System.IO.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'WinRTLegacy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
It’s placed here - Editor\Data\PlaybackEngines\metrosupport\Managed\UAP, I doubt you can remove it, but you probably can provide an empty assembly instead No promises, that it’ll work though