Xamarin 项目中的正确依赖管理 [英] Proper dependency management in a Xamarin project

查看:27
本文介绍了Xamarin 项目中的正确依赖管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试改进我们项目中的依赖项管理.我们有一个典型的 Android/iOS Xamarin 项目,并使用 Xamarin-Studio 作为 IDE.对于共享代码,我们使用一个 PCL 和两个共享项目(随 Xamarin 3 引入).

I'm currently trying to improving the dependency management in our project. We have a typical Android/iOS Xamarin Project and use Xamarin-Studio as IDE. For the shared code, we use one PCL and two Shared Projects (introduced with Xamarin 3).

直到现在,我们只有一个包含 DLL 的文件夹来处理第三方库……ofc 不是正确的方法.现在我们正在努力改善这个问题.

Until now, we simply had a folder with DLL's to handle the third party libraries... ofc not the proper way. Now we try to make some efforts to improve this issue.

对我来说,有一个大问题:Xamarin.Components 还是 NuGet? 这种方法之间的区别在哪里?您使用哪种类型的依赖项?

For me, there is one big question: Xamarin.Components or NuGet? Where is the difference between this approaches? And what do you use for which type of dependency?

在我看来,NuGet 是一种处理依赖的正确方式...一个简单的依赖定义文件,自动更新,处理传递依赖,我只需要签入一个文件,NuGet 会自动下载所有必要的文件,等等...另一方面,Xamarin.Components 在 xamarin 世界中似乎更加成熟......我不仅在那里发现了 json.net 和 sqlite.NET 等库,而且还发现了前端组件,例如ZXing.Net 或 BTProgressHUD...

From my point of view, NuGet is a proper way to handle dependencies... A simple definition file for dependencies,auto-update, handles transitive dependencies, I only need to checkin one file and NuGet automatically downloads all necessary files, and so on... On the other side it seems that Xamarin.Components are more mature in the xamarin world... I find not only libraries as json.net and sqlite.NET there, but also front-end components like e.g. ZXing.Net or BTProgressHUD...

了解如何处理跨平台项目中的依赖项会很有帮助!

It would be very helpful to know how do you handle dependencies in your cross-platform projects!

推荐答案

两者都使用.您将无法在 Xamarin 组件商店的 Nuget 中找到很多东西,反之亦然.

Use both. You won't be able to find a lot of stuff in Nuget in the Xamarin Components store and vice versa.

Xamarin 组件可以自行恢复,您可以在构建服务器上设置它以在您的解决方案上运行 xpkg.exe restore,以便您可以拥有 CI.

Xamarin Components restore themselves and you can set it up on your build server to run xpkg.exe restore on your solution, so that you can have CI.

您应该注意,现在 Xamarin 组件不能依赖其他 Xamarin 组件,所以这就是 NuGet 更好的地方.Xamarin 还有一个 looooooooooooong 接受新组件和更新现有组件的过程,这可以使 NuGets 更受欢迎,因为您可以更快地发布新版本.

You should note, that right now Xamarin Components cannot depend on other Xamarin Components, so this is where NuGet is better. Xamarin also has a loooooooooooong process of accepting new and updating existing components, which can make NuGets more preferable as you can have newer releases quicker.

因此,由于 Xamarin 组件的限制,我的总体意见是将大部分依赖项保留为 NuGet.

So generally my opinion is to keep most of the dependencies as NuGets, because of the limitations of Xamarin Components.

这篇关于Xamarin 项目中的正确依赖管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆