How to share Windows 8 WinRT Metro style libaries/components across apps

Deadly 提交于 2019-12-06 11:30:48

As a general rule, each WinRT/Metro style application can access only dlls that are built into Windows or are shipped in their appx package. There is no facility to ship centrally referenced dlls. Each application that wants to use a dll/library will need a copy that ships with it.

You can share libraries, you just won't be doing it using DLLs. You can easily create a class library with common utilities and functions, then reference/share it in your application. You can also drop to C++ and create your own shared functions via WinRT.

As you point out there isn't any kind of Global Assembly Cache for saving a single instance of a library/component and sharing it with any app that needs it. While the GAC in .NET is nice, I don't think very many developers take advantage of it. Hoe many one off .NET apps share component assemblies that are saved in the GAC? I believe the percentage isn't very high, consequentially all those assemblies are duplicated. The decision to not spend time on a Metro GAC seems warranted to me.

They would need to implement 3 global caches for Metro if they did build it. One for each .NET, C++ and JavaScript. It seems to make sense. This just sounds like a mess. Plus, how does the cache know that no apps on the machine use a certain assembly anymore and it can be deleted? Messy...

This is a fairly complex topic, and doesn't really have a short answer solution. No matter the debate, they may be working on a solution to this and just haven't released it in the Windows Developer Preview. More time is needed to see how the platform evolves closer to release.

WinRT allows a Metro application to take a 'dependency' on a Framework object. That object can contain all the shared DLLs, etc. that multiple applications may use.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!