Visual Studio For Mac: Using NuGet

Visual Studio For Mac: Using NuGet


[MUSIC]>>Hello, everybody. I’m Cody, Program Manager for
Visual Studio for Mac. Today, I’m going to show you how to get the most out
of Visual Studio for Mac by using NuGet with
your projects. Let’s get started. I’m going to click
on “New Project” and create a new Xamarin Forms Project. So, click on old type
platform App, link Forms App. When near a Mobile App, it’s like my target platforms
and my shared code technology. This all looks fine,
so I’m going to click “Next” and then again click “Create”. The budget is created, let’s add some packages. I’m going to expand
the dependencies folder under the Mobile App shared project
and notice this has NuGet. I clicking on NuGet allowing
me to add packages. Here, you have a list of all the different packages
available to you. There are several things
you can do in this view. You can search, you can
select pre-release packages, and you can add packages
to your project. You can also select
specific versions. In this case, let’s add
Newtonsoft.Json to our project. So, I’m probably going to
have to parse some JSON. Click on the package you want to add, mix the versions the one you
want and click “Add” package. You can see Newtonsoft.Json
was successfully added. Let’s say there’s a hot new feature
that I want to test. Let’s add a preview version. So again, right-click on NuGet, hit “Add Packages”, and
set “Show pre-release”. Now, we can see that
some of these packages offer latest versions
including Alpha builds. So, let’s add the latest version
of “Entity Framework” to our project 6.2.0 Beta1. Click on the version. Click on the package you want to add, and click “Add Package”. Once again, it’s added just
like any other version. You might have to accept
the license though. There we go, added to our project. Now, not all of the packages you want are going to be
available on the main NuGet feed. Some packages maybe on custom feeds such as my Git or
an internal NuGet repository. So, I’m going to show you how to add a custom feed to your project. To do this, I’m going to add the Xamarin.forms for
my Git preview package repository. Already have Xamarin forms
nightly pulled up. So, here I’m going to click
on this and it copy link. Back in Visual Studio, in a Visual Studio preferences, navigate down to the NuGet section
and click on “Sources”. Here, I can click “Add”, give it a good name, and paste in the location or folder. If you have a folder
in your network share, you can add that as well, but since this is a URL,
let’s just paste that in. Here, we click on “Add Source”. Now, we see that forums preview is available in the preferences pane. Go ahead and click “Okay”, and now let’s see what we have there. Once again, let’s go back to NuGet, think we’re going to have package. Here, you now have a dropdown, we can set which source
you want to pull from. You also configure sources here if
you want to add another source. Let’s click on the forms
preview that we just added. It’s going to load the package list, which gives us a whole list of all this custom packages
on this feed. Once again, it is the enterprise environment and
you have a custom NuGet feed, you would see
your custom packages here. Let’s go ahead and add the
nightly build a Xamarin.forms. As it’s adding to our project, please keep in mind there
are several ways to access NuGet, accept this license. You can also go to “Project”, “Add NuGet Packages”, “Update
NuGet” or “Restore NuGet Packages”. Furthermore, if you expand NuGet, you can see all the packages that
are involved in your project. Here, you see the
version numbers as well. You’d also update them if needed. Adding NuGet to your project
and adding packages from NuGet, can really extend the capabilities
that you’re working with. Also, adding your
enterprise environment can make sure that
all the packages that you need are available to you. In this video, I showed you how to add new packages to your project, and add a new NuGet feed
to your solution. Please stay tuned for more videos
in the series. Thank you. [MUSIC]