Is it possible to reference .NET Framework library in a Xamarin.Forms app?

心已入冬 提交于 2019-12-11 00:34:28

问题


I have a Xamarin.Forms project (.NET Standard 2.0 library + Microsoft.NETCore.UniversalWindowsPlatform 6.0.7) and I would like to reference a .NET Framework 4.6.1 library.

I added a reference to my Framework library in the .NET Standard 2.0 library, but this result in the error

Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: FrameworkLib, Version=1.0.10735.0, Culture=neutral, PublicKeyToken=null.

I tried to add the reference to my FrameworkLib in the UWP project, but it fails with the message:

Unable to add a reference to project 'FrameworkLib'

Is it possible to add a reference to add a reference to a .Net Framework 4.6.1 library in a Xamarin.Forms app? Do I need a special NuGet package?

According to https://docs.microsoft.com/en-us/dotnet/standard/net-standard it seems like it should be compatible? I can reference my UWP project in my FrameworkLib, but not the other way around...

I can reproduce this with empty projects. (VS 2017)

来源:https://stackoverflow.com/questions/48893655/is-it-possible-to-reference-net-framework-library-in-a-xamarin-forms-app

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