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.
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.
- Open a supported version of Microsoft Visual Studio.
- Choose File > New > Project (or click New Project on the Start page) to create a project.
- Click Windows Desktop > WPF Application in the New Project dialog box (you can create your project in either C# or VB .NET).
Visual Studio 2015 organizes project types slightly differently. You'll find WPF Application projects under Windows > Classic Desktop
If you decide to use the ArcGIS Runtime template, you will not need to complete the steps described in this topic.
- Choose a folder location for your new project and give it a name.
- Click OK to create the project.
Your project opens in Visual Studio and contains a single WPF window called MainWindow.xaml.
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.
- Right-click the References node under your project listing in the Visual Studio Solution Explorer window, and click Add Reference in the context menu.
- Check the listing for the Esri.ArcGISRuntime assembly under Assemblies > Extensions.
- Click OK to add the reference to ArcGIS Runtime for .NET.
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.).
- Open the MainWindow.xaml file in the Visual Studio designer.
- 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.
- 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.