Managing & Updating Xamarin NuGet Packages Efficiently

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back everyone today we are going to continue building our xamarin application which uses xamarin forms for the user interface today we're going to be talking about upgrading our nougat packages getting xamarin forms onto the latest and greatest and how you can determine all those dependencies and make sure they're up to date too so tune in welcome back everyone i'm james montemagno i'm a program lead for the.net community over at microsoft i've been a xamarin developer for nearly 10 years i love building out xamarin applications on this channel and we've been building out our application from file new going through configuration today we're going to update our xamarin forms nuget packages and we're going to build this application out together now i will put links over here and down below for the previous episodes in case you missed them but hey while you're here make sure you subscribe and hit that notification bell so you get notifications of all of the episodes that i release here on my channel i normally do live coding but i also do sorts of different things on the channel but usually focus in on xamarin and building up mobile applications but who knows what's next let me know what you want to learn below so i can go through them here in different tutorials all right let's go through upgrading our xamarin forms nuget packages in fact all nuget packages well what is a nuget package well that's a good question i built a microsoft learn module which is a free interactive training module to learn all about net and c sharp dependencies using nuget packages so i'll put that link down in the show notes you can learn and go through an activity yourself on how to install update and inspect different nuget packages that are out there now keep saying nuget packages nougat is a sort of distribution of code in a way but these this code is usually assemblies that your application can use so for example let's say you want some new functionality you could write it yourself or there might be someone from the community that has put out a nuget package that you could use so they wrote the code they bundled it up for you and you can install it inside of your application and use it which is super cool i've done it myself and in fact that is how xamarin forms and xamarin essentials are distributed as nuget packages this is different from net itself or different libraries that are built into net for your applications that ship with visual studio or shipwith.net they get updated when you update.net these nuget packages are pieces of code and functionality that your application can use over time and they update independently of your application so often when you do file new and you've been working on a project with anything but specifically even with xamarin forms often you want to check for updates because you'll get bug fixes new features and new controls and new performance optimizations all by updating the nuget dependency so you always want to check these out sometimes the id you can set it up to notify you but often i just go in once a week every other week or just follow the xamarin blog or the release notes to see when things have been updating the xamarin team is pretty quick so they have new updates out sometimes every single week so you can follow along so let's hop over into visual studio and see where we're at today so we've been building on an application that is called a my coffee app and this is what i just started and we haven't done anything really yet but we're just sort of learning the basics the building blocks here and we have my coffee app android and ios so this is our.net standard project our android project and our ios project so let me zoom in over here one more time and what i want to show you is that inside of each application we'll see a dependencies node and here we're going to see both packages and sdk sdk specifically are things that are coming from.net like this the.net standard library can't really upgrade that it just comes with it under packages we're going to see that there's both xamarin essentials and xamarin forms you can have a drop down here that will show you what's included if there's any dependencies so we can see inside the.net standard version of xamarin essentials system numeric vectors is required and for xamarin forms nothing's required that's nice now if i go down under android and ios under references we'll see a bunch of different system libraries that are used then we see this little nuget icon here because that's where xamarin essentials and xamarin forms are now since xamarin projects have a older sort of they haven't upgraded to the latest project setting and system we don't get those nice drop downs here but that's okay because i'll show you how to investigate your applications but the same thing is going to be true here for ios under references we'll see xamarin essentials and xamarin forms now once dotnet six comes out and xamarin applications are migrated over you'll see sort of the new drop-down system here which is cool inside of it but for now we get xamarin essentials xamarin.forms now that is what is installed by default for us and if i right click over here on my solution there is an option that says manage nuget packages for solution that's important you can right click on any project and say manage nuget packages but you almost always want to manage nuget packages for the entire solution you want to upgrade everything over here so once you do that this brings up the nuget solution sort of explorer and it says hey this is the nuget package explorer for the solution and we can see that the.net standard library actually has a package installed it's included automatically you have xamarin essentials and xamarin forms and that's because we're on the install tab note that if you actually go to updates it's going to tell us that both xamarin essentials and xamarin forms have an update well do i really have an update well let's check it out here because we can note that i actually have a check box that says include pre-release so this is up to you if you want to use the stable versions or you want to participate in testing out the pre-release or the next version of xamarin essentials and xamarin forms and we can know that it says hey you have version 1532 and the next version 160 pre-four is actually available same thing with xamarin forms 480 and then also 5.0 the next version is coming out soon so you can decide if you want to update your nuget packages based on this information some developers actually want to just use what's included in stable and not in the pre-release and that's okay but notice here i unchecked it and still i have an update available for xamarin forms here's 480 480 and then different version numbers right here now let's walk through what this means okay so i'm going to go ahead and and zoom out and then zoom in one more time for us here now note that four is the major and then we have two different minor numbers here so 4.0 is like major and that usually represents if there's a bigger breaking change in our application and sometimes there is sometimes there isn't you want to read the release notes usually here what this means for the minor versions is this is when a new feature has been added so normally there's new features you just want to update xamarin forms sometimes have in the past use this version for service releases when it's substantial but now they're more on a build system where this fourth number the build number here is just for when new bug fixes come out so sometimes you may see a 481 which means that there's bug fixes sometimes more substantial but usually just smaller iterative releases here is what you want to do so check this out when you go and you want to update it's very simple you can check the check box here hit update or you can come over and select the version number that you want to install here so let's say that you install it but accidentally uncheck one or accidentally only installed the nuget package into one of your projects you're opening an older project if i hit install here this is going to go off it's going to go update version 480 1687 from 145 whatever i have four five one i'm gonna go ahead and hit okay it's gonna tell me exactly what it's doing i'm gonna hit okay here if the nuget package that you have has a license the xamarin forms one does under mit you have to accept it to install it and it's going to go ahead now and update my.net standard project and my android project over there so let me go ahead and pull this out a little bit here so we can note that if i look now that there's actually two versions installed because i uncheck that checkbox and that's actually not good you'd want to definitely make sure that you're not doing this in fact the nuget solution explorer will tell you so it says hey you should consolidate you have mix mismatching version numbers of xamarin forms installed in your application so here you know you want to make sure that you install to the latest stable on all of them so let's hit install and go there we go right and it'll update just the ios one there so it's important to upgrade along the way as you're going now this is only going to show you the top level nugets that you have installed and it doesn't mean that there's not dependencies that are installed for you automatically so here for xamarin essentials and xamarin forms what we'll note is if i scroll down inside of here we can see that there are these things called dependencies and what this is saying is that for android if you are compiling as android 10 or higher we're going to use android x which is the latest and greatest from google for adding backwards compatibility to our app if you're compiling it's nine then the android support libraries will be brought in for uwp this uap app there are a few additional dependencies like win ui and win2d that'll be brought in and that's based on the version number that you have and there's also even tizen support down here notice that actually ios has no dependencies so that's kind of cool actually automatically now you can check these out here inside of the nuget solution explorer or you can go over to nuget.org here's a way of browsing all the different packages so here i can actually browse see a bunch of different awesome libraries that are available so here's newtonsoft.json which has nearly a billion downloads which is for json serialization and deserialization you can search for anything like xamarin forms for example and that will show you any of the different xamarin forms packages like xamarin forms maps and visual material so here i'm going to go ahead and say just what's in xamarin forms you can see that it was updated six days ago it has a url you can check out the source repository the license you can contact the owners you can download the package and you can see how active this nuget package is nearly 20 million installs you can additionally see all of the different versions here and all the different versions of pre-release and stable so you can see we're 11 days ago updating to that version many people are using the preview and checking out along the way there's a few other cool features that are inside of here such as dependencies this is what showed up inside of the user interface of visual studio except for you can actually click deeper and see what the dependencies of that dependency are and go further down the sort of rabbit hole if you will of nuget packages and you can also see used by this is a cool feature you can see that it'll show you some of the most popular different frameworks and libraries that are using xamarin.forms so you can see hey what is this image loading library what is this pop-in library has really a few million installs i might want to check that out which is nice same thing here it's also going to show you github repositories all sorts of different ones that have this as an example so reactive ui the eshop on containers example so there's a lot of things in here now one thing that's really neat that some people overlook is you can actually download the nuget package here and inspect it so if you go over to the microsoft store on windows there's something from uh claire novani who i work with actually is on the board the.net foundation called the nuget package explorer it's only available in windows 10 but it's really awesome you can download it and when you download a nuget package you can say open and you can go ahead and say open it with the nuget package explorer and this will give you a way of inspecting everything that was bundled up and packaged so much of the information that was inside of the portal and on the website you can see exactly who it was published by you can see the sha for the publishing the repository it was in if the signature is valid here there's no source link information here which is fascinating but who the authors are the mit license and then up here is really fascinating it's the package contents it's sort of nerding out on package dependencies but you can come in to this thing and you can decide what are all of the actual dependencies that are being brought in all the dlls all the libraries for different net standard for tizen you can look at builds different properties here's a proguard file that's automatically configured for you assets like an image that are here so you can really kind of go in and say what is all this stuff that's really coming in and what's brought into my application for dot net 4 6 done at standard you know all these different things which is really neat so you can kind of really determine oh there's language files or resources that are coming in you can really investigate everything that's going on inside of here so this is really really cool it has a shot as a pre-release everything like that if you wanted to you could also click on an newer version or a stable version so here i'm going to click on 480 and then download that package and now when i go ahead and open that up let's go ahead and see there we go that we will note that in this version as it goes through is that we have a valid signature no source link information on that one but we have mit we have all the different settings it has the git repository all the dependencies are in here too you can actually click on one you can open open it in the feed you can download it and kind of really navigate through this it's really awesome and i'll link that into the show notes below too all right so a few things back over here in our last episode we went in we actually upgraded our android project over here to use android 10 so you want to make sure that you have updated your libraries everything like that and make sure that it is updated it's good to go using android x like we saw you may inside of nuget over here see additional libraries maybe of an older xamarin project well you can you can edit that you can actually come in into a project and say open well what i like to do actually is i like to do an unload project on android and then this will show you what's inside of the cs proj file and here we're going to see that there's a target framework which i'm compiling against if i scroll down keep scrolling keep scrolling we will note that there are these things called package references this is what the nuget package explorer is using to show you if there's upgrades available and what is changing at the end of the day so this is saying hey use xamarin forms version this number so you could open this in vs code find all of them in your your project and your folder or even upgrade it manually so if you knew the version you could shove it in here and try to upgrade it manually if you're using older versions of xamarin forms and have an older project you may see a lot of different android dependencies things like that you want to get rid of those things and you want to make sure that you just have just xamarin forms just xamarin essentials and it will bring in the different dependencies for you automatically same thing is true over on ios if you click unload over here it'll bring up the cs proj and as you scroll down you're going to see a bunch of different information and finally the package references so that's how you really know what's included in your app same thing true over here i can just double click on the dot net standard project it uses the newer project systems and we can see here's just xamarin forms and xamarin essentials so it has everything you need right here the defaults are good to go so if you ever needed to modify or bring things in you have everything at your fingertips right here inside of your project that was a lot of information but we walk through exactly how to determine what is installed in your application what the dependencies are how to upgrade how to upgrade a pre-release how to explore the nuget packages what is a nuget package and of course how to even find new nuget packages that are out in the world um that you can explore now another thing i want to show is the xamarin plugins or repo that i have over on my github this is a really neat repository that will show you all the really great nuget packages that are out there for xamarin and xamarin.forms applications things like xamarin essentials shiny which is a great library that is really advanced http transfers background jobs bluetooth but you can scroll through and find different functionality for your app like custom vision file uploaders geo location in-app building screen shot store reviews toast different databases and caching layers and just some awesome.net libraries that you may want to include in your application so all sorts of good stuff here if you're like hey where do i go or what are some great control vendors out there that are that are enabling me to do this stuff so you can go through this i'll put it in the show notes below but it's on my github it's called xamarin plugins all right well that's going to do it for this episode i hope you really enjoyed it i like to kind of go really deep on these different subjects how you can upgrade because as you're developing your application once you know how to do it once you're going to seamlessly upgrade in the future now i will say how do i determine where do i upgrade do i do pre-release do i not do pre-release well it depends on what functionality you want if there's some really cool features in pre-release and you have a while till you release go check it out if you're up against a deadline maybe don't update all your nuget packages and just test as is you want to definitely check out the xamarin and xamarin forms release notes and xamarin essentials release notes i'll put those in show note links below as well but definitely i encourage you to check out the latest pre-releases upgrade i nearly upgrade seamlessly every single time but always use version control whether using git or subversion or github or bitbucket make sure you just create a branch and say nuget update on this day and you can always roll back easily enough but you've also learned in this video exactly where those settings are they're inside of your cs proj so you can easily adjust those at any time all right well that's going to do it again for this episode don't forget to subscribe and ding that notification bell so you get notified on all of the next upcoming episodes that i have in building our very first xamarin application for ios and android with xamarin forms now if you want to go a little bit deeper don't forget that i live stream on fridays on twitch.tv slash james montemagno and i also have some of my past episodes down over there in the past video there's a live stream category so definitely check that out all right everyone thank you so much don't forget to go ahead and hit like on there if you like this video and leave some comments i've been reviewing all the previous comments that have been coming in helps me know what you want to learn so i can make new videos that hopefully help you out on your journey to building applications with xamarin c-sharp and dot-net and all that good stuff all right everyone have a good one and thanks for watching
Info
Channel: James Montemagno
Views: 8,813
Rating: undefined out of 5
Keywords: xamarin, xamairn.forms, nuget, upgrades, .net, uwp, android, ios
Id: nDfO74TXQUg
Channel Id: undefined
Length: 21min 22sec (1282 seconds)
Published: Thu Dec 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.