Creating a new project

When you begin writing a new app you need to incorporate Couchbase Lite into your project. This lesson shows you how to add Couchbase Lite and its other dependencies to a new project.

Create a new project for iOS


Open Xamarin Studio and do the following:

  1. Select File > New > Solution.
  2. In the New Solution, select iOS > Classic API > iPhone > Empty Project.
  3. Enter the following information and click OK.
    • Name : HelloCBL
    • Solution Name : HelloCBL
  4. The HelloCBL solution will be created and opened. You should be able to see AppDelegate.cs, which is the starting point of the application.
  5. Select View > Debugto see both the Solution structure and the editor pane.
  6. Add Couchbase Lite .NET library to project

Create a new project for Android


Open Xamarin Studio and do the following:

  1. Select File > New > Solution.
  2. In the New Solution, select Android > Android Application.
  3. Enter the following information and click OK.
    • Name : HelloCBL
    • Solution Name : HelloCBL
  4. The HelloCBL solution will be created and opened. You should be able to see MainActivity.cs, which is the main activity of the application.
  5. Select View > Debugto see both the Solution structure and the editor pane.
  6. Add Couchbase Lite .NET library to project

Add Couchbase Lite .NET library


Developers can use Couchbase Lite .NET library by adding the Couchbase Lite .NET NuGet package.

  1. Select Project > Add Packages ....
  2. Search for 'Couchbase Lite' and select the latest version of the Couchbase Lite and click Add.

It may take a few minutes for the Xamarin Studio to add the packages and all of the dependencies. Under the HelloCBL > Packages folder, the following packages should be seen:

Add the Starter Code


In your main application code, i.e. AppDelegate.cs or MainActivity.cs, add the using statement as follows:

using Couchbase.Lite;