Skip To Content

Add ArcGIS Runtime SDK references

In this topic

In order to work with ArcGIS Runtime SDK for .NET using Visual Studio, you will need to reference the assembly in your project and also add any required XML namespace references in your XAML. This process is not unique to ArcGIS Runtime SDK for .NET, you will follow it for any additional assembly you want to use in your project.

The following steps guide you through creating a new Visual Studio project for your Windows Desktop application. You will also learn how to add the proper project and namespace references for working with ArcGIS Runtime SDK for .NET classes. You can follow these same basic steps for every ArcGIS Runtime SDK for .NET project you create.

Tip:

ArcGIS Runtime SDK for .NET provides a project template for creating your mapping app, called ArcGIS Runtime 10.2.7 for .NET App. Creating your project from the template will add the appropriate references and a page with a map view containing a single base layer. In this tutorial, you'll build your app from a blank template.

Create a WPF app

You'll use Visual Studio to create a WPF app.

  1. Open a supported version of Microsoft Visual Studio.
  2. Choose File > New > Project (or click New Project on the Start page) to create a project.
  3. Click Windows Desktop > WPF Application in the New Project dialog box (you can create your project in either C# or VB .NET).
    Note:

    Visual Studio 2015 organizes project types slightly differently. You'll find WPF Application projects under Windows > Classic Desktop

    Tip:

    If you decide to use the ArcGIS Runtime template, you will not need to complete the steps described in this topic.

  4. Choose a folder location for your new project and give it a name.

    Visual Studio New Project dialog box

  5. Click OK to create the project.

    Your project opens in Visual Studio and contains a single WPF window called MainWindow.xaml.

  6. Next, you'll add a reference to the ArcGIS Runtime SDK for .NET API assembly.

Add a project reference to ArcGIS Runtime

When you create a new project from one of the standard templates, Visual Studio does not know about the ArcGIS Runtime. To use the ArcGIS Runtime classes, you must add a reference to the ArcGIS Runtime assembly in your project.

  1. Right-click the References node under your project listing in the Visual Studio Solution Explorer window, and click Add Reference in the context menu.
  2. Check the listing for the Esri.ArcGISRuntime assembly under Assemblies > Extensions.

    Visual Studio Reference Manager dialog box

  3. Click OK to add the reference to ArcGIS Runtime for .NET.

    Visual Studio project references

  4. The Esri.ArcGISRuntime library contains the Map control and all core API components and classes you'll need.

Add XML namespace references

In addition to the project reference you made to the ArcGIS Runtime assembly, you must also add an XML namespace reference in your XAML page (MainWindow.xaml, e.g.).

  1. Open the MainWindow.xaml file in the Visual Studio designer.
  2. Go to the XAML view of the designer and add the following XML namespace reference to the Window XAML element. Visual Studio offers Intellisense to help complete the URL portion of the statement.
    xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"

    XAML namespace declaration

  3. All XAML elements from the ArcGIS Runtime API are available in the http://schemas.esri.com/arcgis/runtime/2013 namespace. They can now be referenced in your page using the esri prefix.
  4. You can now use the XML prefix you've defined to work with ArcGIS Runtime SDK objects in your XAML. The following code sample defines a new MapView control and Map containing a single basemap layer.
    <esri:MapView x:Name="MyMapView">
       <esri:Map x:Name="MyMap">
          <esri:ArcGISTiledMapServiceLayer ID="BaseMap" 
                ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
       </esri:Map>
    </esri:MapView>

The process described in this topic is generally the first thing you'll do for each ArcGIS Runtime SDK for .NET project you create from a standard Visual Studio template. The details for adding these references differ slightly between SDK platforms.

Related topics