简体   繁体   English

将Windows Store项目引用到.Net Framework程序集,例如类库

[英]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.

相关问题 从CoCoa应用程序引用.NET Framework 4.5类库项目 - Referencing .NET Framework 4.5 Class Library project from CoCoa application 在.Net Standard类库中引用.Net框架库时出现的问题 - Issue while referencing a .Net framework library in .Net Standard class library 从类库(Windows)引用.NET Core类库 - Referencing .NET Core Class Library from Class Library (Windows) 在.NET Core App 1.0.0项目中引用Framework 4.6 Library - Referencing Framework 4.6 Library in in .NET Core App 1.0.0 project 从Windows类库引用.NET标准库 - Referencing a .NET Standard library from a Windows Class Library 从 .Net 标准类库引用 .Net Core 3.1 项目 - Referencing a .Net Core 3.1 project from a .Net Standard Class Library 从.net中的类库项目引用设置的最佳实践 - Best practice for referencing settings from a class library project in .net 在面向.NET 4的项目中引用.NET 2程序集 - Referencing a .NET 2 assembly in a project targeting .NET 4 无法在引用 .Net 标准库的已发布 .Net 4.6.1 项目中加载文件或程序集“System.ComponentModel.Annotations” - Could not load file or assembly 'System.ComponentModel.Annotations' in published .Net 4.6.1 project referencing .Net Standard library 将.net类库移植到Windows应用商店类库 - Porting A .net Class Library To Windows Store Apps Class Library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM