Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using legacy assemblies in metro style app

I understand that we can access part of the .net apis and all the winrt apis in a metro style app written in c#. But what about other third-party components that target .net 2.0 or 3.5, etc. will we be able to add them as references in a metro style app project?

like image 327
Cui Pengfei 崔鹏飞 Avatar asked Oct 11 '11 07:10

Cui Pengfei 崔鹏飞


1 Answers

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.

like image 113
Roman Boiko Avatar answered Nov 03 '22 04:11

Roman Boiko