[英]Referencing Windows Store project to .Net Framework assembly, eg Class Library
I think, I can understand why, I can not reference any .Net Framework assemblies to any WinRT projects - targeted to .Net Core. 我想,我能理解为什么,我不能将任何.Net Framework程序集引用到针对.Net Core的任何WinRT项目。 Portability and so on... bla bla bla... 便携性等等... bla bla bla ...
But I can not understand, why I can not do it in vice versa! 但是我不明白,为什么我不能做到这一点呢!
For example, when I want to add some Windows Store assembly reference to regular .Net Framework assembly, I get error. 例如,当我想向常规.Net Framework程序集添加一些Windows应用商店程序集引用时,出现错误。 Is it any logical reason why it is impossible? 这是不可能的逻辑原因吗?
Yes, there is a perfectly logical explanation for this: .NET for Windows Store apps (or .NET Core) is not a subset of .NET Framework (or its Client profile). 是的,对此有一个完全合乎逻辑的解释:Windows Store应用程序的.NET(或.NET Core)不是.NET Framework(或其客户端配置文件)的子集。 It's a completely separate platform, just like Silverlight or Windows Phone. 与Silverlight或Windows Phone一样,它是一个完全独立的平台。 In fact, it is strongly based on an older version of Silverlight. 实际上,它强烈地基于旧版本的Silverlight。
The only way to share a class library between a Windows Store app and a regular Windows (.NET) application is to create a portable class library. 在Windows Store应用程序和常规Windows(.NET)应用程序之间共享类库的唯一方法是创建可移植类库。 By selecting the target platforms for it, you'll get a specific subset of APIs that are available on all selected platforms. 通过选择目标平台,您将获得在所有选定平台上都可用的特定的API子集。 You'll be able to reference such a library in any project using one of selected supported platforms. 使用选定的受支持平台之一,您将可以在任何项目中引用此类库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.