For those of you who aren’t aware, NuGet is a part of Visual Studio that provides the capability to add third-party components and their dependencies to your projects in an easy-to-use GUI or command-line tool. At Telerik, we’ve already been distributing NuGet packages for a vast variety of our products so companies can create private NuGet feeds for their developers. Recently, we included UI for Xamarin. In this blog post, I’ll walk you through setting up a private NuGet server that you can use for UI for Xamarin and our other products that support it.
Setting Up a Private NuGet Package
Open Visual Studio and create a new project. Select Web -> ASP.NET Web Application -> Empty as shown below. It doesn’t matter what you name the project.
Once the project is created, right-click on the project and select “Manage NuGet Packages.”
In the NuGet dialog, search for NuGet.Server. Once found, click on the item in the list, and click its Install button. The latest version at the time of this writing is 2.8.5.
You’ll need to accept the license. Your project should now look like the following:
Create a folder on the machine that will be hosting your NuGet packages and make note of the name. I installed mine to C:\PrivateNuGetPackages.
Open the Web.config, scroll to the bottom of the file, find the packagesPath key and enter your path there. Mine looks like the following:
<add key="packagesPath" value="C:\PrivateNuGetPackages"/>
Run the web app, and you should see the following:
Copy and paste the URL the repository URL. (ex. http://localhost:5508/nuget).
Adding Your Private NuGet Feed to Visual Studio
Switch back over to Visual Studio and go to the Tools-> NuGet Package Manager -> then select “Package Manager Settings.” Now click on “Package Sources.”
Adding Your Private NuGet Packages
Log into your account and select “Download Installer and other resources.” Navigate to our UI for Xamarin Cross-Platform, and click on “Browse all product files.” Download the file called “Nuget packages.”
Extract the .zip file into the folder where your NuGet Packages are located, and you should see the following dialog once you go back to the “Manage NuGet Packages” dialog and select the “Telerik Private NuGet Feed:
Click the “Install” button. The Telerik references and any Xamarin dependencies will be automatically added to your project. This works for Xamarin.Forms, as well as our Xamarin Wrappers, all with one click!
You are now ready to begin using our controls in your next Xamarin app.
Before you go, feel free to download a trial of UI for Xamarin and checkout our new ListView for Xamarin.Forms, as well as a new DataForm and Alert control for Xamarin Wrappers.
Thanks for reading! If you have any questions, feel free to leave a comment below.