问题
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).
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.
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?
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!
回答1:
Use both. You won't be able to find a lot of stuff in Nuget in the Xamarin Components store and vice versa.
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.
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.
So generally my opinion is to keep most of the dependencies as NuGets, because of the limitations of Xamarin Components.
来源:https://stackoverflow.com/questions/24628891/proper-dependency-management-in-a-xamarin-project