- Home /
Referencing dlls in Unity Windows Store application
Hello,
I am trying to use WinRT Component in Windows Phone(8.1) Application built through unity. The Windows Runtime Component is "CustomVideoMFT.winmd". I have written a wrapper in .net(BridgeWrapper.dll) which acts as the bridge around Windows Runtime component & Unity.
There are two versions of this Bridge i.e one for the Windows Store Application & other one is a placeholder version for the Editor to successfully compile the scripts.
But, when I am trying to build the Project as a windows store Application, it fails with the following error:
Exception: Failed to run Reference Rewriter with cmdline --target="Temp/StagingArea\Plugins\WSA\BridgeWrapper.dll" --framework="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhoneApp\v8.1" --additionalreferences="Temp/StagingArea","Temp/StagingArea\TempSerializationWeaver\Plugins\WSA","Temp/StagingArea\TempSerializationWeaver\Plugins\WSA\X86","Temp/StagingArea\TempSerializationWeaver\Plugins\WSA\ARM","Temp/StagingArea\TempSerializationWeaver\Plugins\WSA\PhoneSDK81","Temp/StagingArea\TempSerializationWeaver\Plugins\WSA\PhoneSDK81\X86","Temp/StagingArea\TempSerializationWeaver\Plugins\WSA\PhoneSDK81\ARM" --platform="C:\Program Files (x86)\Windows Phone Kits\8.1\References\CommonConfiguration\Neutral\Windows.winmd" --support="Temp/StagingArea\UnityEngine.dll" --supportpartialns=Unity.Partial --system=System --dbg=pdb --alt=System.Xml.Serialization --ignore=System.IConvertible,mscorlib.[Temp/StagingArea\Plugins\WSA\BridgeWrapper.dll] Catastrophic failure while running rrw: System.NotSupportedException: Specified method is not supported. at Mono.Cecil.PE.ImageWriter.WritePEFileHeader() at Mono.Cecil.PE.ImageWriter.WriteImage() at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters) at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters) at Unity.ReferenceRewriter.Program.Main(String[] args) PostProcessMetroPlayer.RunReferenceRewriter (WSASDK wsaSDK, System.String playerPackage, System.String stagingArea, System.String assemblyPath, System.String winRTLegacyPath) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessMetroPlayer.cs:325) MetroPlugin.RunReferenceRewriter (System.String playerPackage, System.String stagingArea, System.String winrtLegacyPath) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/MetroPlugin.cs:148) PostProcessMetroPlayer.PostProcessSDKSpecific (WSASDK targetSDK, BuildTarget target, BuildOptions options, System.String playerPackage, System.String stagingArea, .ProjectImages images, .LibraryCollection libraryCollection) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessMetroPlayer.cs:890) PostProcessMetroPlayer.PostProcess (BuildTarget target, BuildOptions options, System.String installPath, System.String stagingAreaData, System.String stagingArea, System.String playerPackage) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessMetroPlayer.cs:597) UnityEditor.Metro.BuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:84) 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()
I am not able to understand which method it is complaining about not being supported. Has anyone faced any similar issue here?
Answer by Ignas83 · May 13, 2015 at 07:40 PM
I assume you are running Unity 5. This exception is usually thrown by Mono Cecil when it's trying to save ARM assembly to disk. Have you marked your BridgeWrapper.dll as an ARM specific assembly in plugin inspector?
Also Unity can handle WinRT assemblies (winmd files) just fine. Maybe you don't need a wrapper?
If nothing above applies could you report a bug with a repro project? It's usually much easier for us to figure out what's wrong exactly.