Yes, sometimes you can reference third-party .NET assemblies from Metro applications. They should be deployed in the same folder as your app and only use supported APIs.
I created a .NET library with one class and used it from metro app. Got the following warning: The project 'EmptyLib' cannot be referenced.
But the app has been built and I was able to debug it and explore the instance of my class in debugger.
Then I tried to pass Windows App Certification. It failed (see details below).
After switching on compiler optimization for app certification passed.
The reason that it failed the first time was that library used not supported APIs. Details:
Error: This application failed the supported API check.
API System.Runtime.CompilerServices.CompilationRelaxationsAttribute in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. EmptyLib.dll calls this API.
API System.Runtime.CompilerServices.CompilationRelaxationsAttribute.#ctor(System.Int32) in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. EmptyLib.dll calls this API.
Impact if not fixed: The application is using one or more APIs that are not in the Windows SDK for Metro style Apps. Use of unsupported APIs violates the Windows Store policy and can have negative impact on the user experience and has the potential to hinder overall system stability.
How to fix: Look at the error messages above2 for the exact API that needs to be fixed. Refer to the Windows SDK for Metro style Apps for the supported list of APIs to use.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…