Navigation

Install Realm for .NET

Overview

MongoDB Realm’s .NET SDK enables development of applications in C# for the .NET, UWP, and Xamarin ecosystems.

For more information about specific version support for .NET, UWP, and Xamarin, see Supported Platforms.

Prerequisites

Before getting started, ensure you have installed Visual Studio:

Installation

Follow these steps to add the MongoDB Realm .NET SDK to your project.

1

Open the NuGet Package Manager

Under the Project menu, select Manage NuGet Packages… to open the NuGet Package management window.

2

Add the Realm Package

In the search bar, search for Realm. Select the result and click Add Package. When prompted, select all projects and click Ok.

3

(Optional) Add the Realm Weaver to FodyWeavers.xml

Note

You can skip this step if you were not already using Fody in your project. Visual Studio will generate a properly-configured FodyWeavers.xml file for you when you first build.

If your project was already using Fody, you must manually add the Realm weaver to your FodyWeavers.xml file. When done, your FodyWeavers.xml file should look something like this:

<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
  <Realm />
</Weavers>
1

Open the NuGet Package Manager

In the Solution Explorer, right-click your solution and select Manage NuGet Packages for Solution… to open the NuGet Package management window.

2

Add the Realm Package

In the search bar, search for Realm. Select the result and click Install. When prompted, select all projects and click Ok.

3

Add the Realm Weaver to FodyWeavers.xml

Note

You can skip this step if you were not already using Fody in your project. Visual Studio will generate a properly-configured FodyWeavers.xml file for you when you first build.

If your project was already using Fody, you must manually add the Realm weaver to your FodyWeavers.xml file. When done, your FodyWeavers.xml file should look something like this:

<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
  <Realm />
</Weavers>

Import Realm

Add the following line to the top of your source files to use MongoDB Realm:

using Realms;