c# - 如何将NugetPackages添加到共享项目?

标签 c# xamarin

我正在创建一个跨平台项目。我想将 sqlite-net 和 sqlite-net 扩展添加到我的共享项目中,似乎我无法将 nuget 包添加到我的共享项目中。有没有办法添加它,或者有另一种方法可以在共享项目中使用 sqlite 扩展而不导入 nuget 包

最佳答案

这就是答案: https://forums.xamarin.com/discussion/70403/add-nuget-packages-is-disabled

When you create a Forms app, the template will ask you if you want to use a Shared project or a Portable Class Library for your shared code. you most likely chose Shared project which is NOT a real project in that it doesn't compile to a DLL like other project types. therefore, you don't add nuget packages to a Shared project. the Shared project uses the nuget packages added to the iOS and Android projects.

think of a Shared project as a collection of source code that automatically gets transparently copied to each of the real projects that use it as if that shared source code was physically part of the real projects.

so if your shared code doesn't compile due to a missing nuget than you must add that nuget to both of your iOS and Android real projects.

关于c# - 如何将NugetPackages添加到共享项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54243602/

相关文章:

c# - 按 id 从通用列表中删除对象

c# - 从 XML 文件获取 ID 属性列表 C#

c# - R.NET 找不到函数 "cor"

c# - 等待 RunOnUIThread 完成并继续执行剩余的任务

android - Monodroid - 如何调试 android 小部件

c# - 代码中的 MvvmLight 绑定(bind)?

android - 如何在 Xamarin Android 的文本更改事件中更改编辑文本的文本

ios - 如何在xamarin中查看sqlite数据库

c# - 注释掉整个文件

c# - C# 有办法实现 &&= 吗?