Skip to end of metadata
Go to start of metadata

Starting from Crosslight 5.0 and above, NuGet Package Manager is now chosen as the main dependency manager for Crosslight projects. With NuGet, .NET developers have been enjoying rapid delivery and updates from third-party vendors and integrate into their existing projects. With more than 500,000 packages and 700 million package installs (and growing), it's even becoming a more prominent evidence that NuGet is the preferred way to go. Even every developer's favorite .NET IDE, Microsoft Visual Studio, have started integrating NuGet Package Manager since Visual Studio 2010.

In this walkthrough, you'll learn how to use the NuGet Package Manager and resolve Crosslight assemblies in your existing Xamarin.iOS, Xamarin.Android and PCL projects. Note that this walkthrough does not cover how to migrate your existing Xamarin apps to Crosslight.

If you're interested in migrating your existing Xamarin apps to Crosslight, check out this walkthrough instead: Walkthrough: Creating Your First Crosslight App.

Follow these steps:

Prerequisites

Before starting this walkthrough, it is recommended that you have fully prepared your machine environment for mobile development. If you haven't done so, it is recommended that you have gone through the following documentation:

It is recommended that you have read through these conceptual topics in order to get a better understanding:

To use this walkthrough, you will need to be able to use Xamarin Studio on Mac and Visual Studio on Windows.

Let's get started. 

Preparing the Project

Let's begin by preparing the project.

Mac

If you're on Mac, follow these steps.

  1. Start by creating a New Solution in Xamarin Studio.
  2. In the dialog that appears, choose Cross-platform App, Single View App.
  3. Enter the project details as follows.
  4. Hit Create.

Your project is now ready.

Windows

If you're on Windows, follow these steps.

  1. In Visual Studio, start by hitting New, Project.

     
  2. On the dialog that appears, choose Visual C#, Cross-Platform, Blank App (Native Portable). Enter FirstCrosslightApp as the project name. Hit OK.

     
  3. Enter the FirstCrosslightApp as the project name. Hit OK.
  4. Your project is now ready.

Configuring Crosslight Packages on Mac

This section describes how you can start using Crosslight NuGet packages on Mac with Xamarin Studio.

  1. Copy and extract the Intersoft.PackageManagement.Extensions.0.1.zip to /Users/(username)/Library/Application Support/XamarinStudio-5.0/LocalInstaller/AddIns/. You can skip this step if you have installed Crosslight using the Mobile Studio 2016 (or newer) installer. You can also verify that this is installed through Xamarin Studio, Add-in Manager

  2. Open Xamarin Studio. You should see that a new Intersoft Package Console Extension is installed. Click on the menu.

     
  3. In the window that appears, type in the following command

  4. This will install the Intersoft.Crosslight package into entire projects in your solution.
  5. At the end of the process, you should see the following message.
  6. Now, your Crosslight references will be ready. To check, expand each project and check the References/From Packages node.
  7. You're now ready to use Crosslight.

The -allProjects switch you've executed earlier is part of the additional command provided by Intersoft Package Console Extension. To see all additional commands available, check out this document: Introduction to Crosslight NuGet Packages.

Note that you only need to perform the above steps when adding Crosslight package for the first time. For updating or restoring existing packages, simply right click on the solution node, then click on Update NuGet Packages or Restore NuGet Packages respectively.

Configuring Crosslight Packages on Windows

This section describes how you can start using Crosslight NuGet packages on Windows with Visual Studio.

  1. In Visual Studio, open Package Manager Console via View, Other Windows, Package Manager Console.

      
  2. In the dialog that appears at the bottom of Visual Studio, enter the following command.

    As shown in the following screenshot.

     

  3. If all goes well, you should see output message similar to the following shot.

     
  4. In your Solution Explorer, you should see Crosslight packages appear in your projects' references.

     
  5. You are now ready to use Crosslight.

Alternatively, you can also use the Manage NuGet UI to browse, install, or update Crosslight packages when using Visual Studio on Windows. See the following steps to learn more:

  1. Right-click on the Solution in the Solution Explorer window and choose Manage NuGet Package for Solution.

     
  2. In the window that appears, choose Browse, then type in "intersoft.crosslight" (without the quotes). Tick all the projects that you would like to apply the package to and hit Install.
     
      
  3. And once it's done installing, you'll see the following in the Output window of Visual Studio.
     
      
  4. You'll see that your Crosslight references are now installed and now you're ready to begin development.

 

Installing Crosslight packages with GUI version of NuGet is only supported in Visual Studio. This feature is not supported in Xamarin Studio as of this writing, due to the limitation of PowerShell scripting which is available only in Windows.

Conclusion

You've just learned how to use NuGet to resolve Crosslight assemblies and use them in your projects. While this walkthrough shows how to apply Crosslight packages in a new project, you can also perform the same steps for existing projects. Keep in mind that Crosslight packages that support multiple targetable frameworks need to be installed only once to the selected projects. For more information about Crosslight packages, see Introduction to Crosslight NuGet Packages.

In this walkthrough, although you are guided to create projects from Xamarin's cross-platform projects, it is recommended to use Crosslight Project Wizard for the best way to get started with Crosslight. By default, all projects created using Crosslight Project Wizard (version 5.0 and above) will automatically use NuGet Package Manager as the main dependency manager, so you can skip this walkthrough altogether. For step-by-step instruction to create a new Crosslight project using wizard, see Walkthrough: Creating New Project with Crosslight Project Wizard.