arcgis-maps-sdk-dotnet-samples
arcgis-maps-sdk-dotnet-samples copied to clipboard
Could not load file or assembly 'Esri.ArcGISRuntime, Version=100.13.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'
I am trying to create map using Esri.ArcGISRuntime.Xamarin.Forms nuget. For this I have created new project in Xamarin.Forms and installed this nuget. Then I have write this code:
Initialize Map key in App.xaml.cs
public partial class App : Application
{
public App()
{
InitializeComponent();
Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.ApiKey = "my_api_key";
MainPage = new MainPage();
}
}
MainPage.xaml: Map UI
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
xmlns:vm="clr-namespace:ArcGis_POC"
x:Class="ArcGis_POC.MainPage">
<ContentPage.BindingContext>
<vm:MainPageViewModel />
</ContentPage.BindingContext>
<StackLayout>
<esriUI:MapView x:Name="MyMapView" />
</StackLayout>
</ContentPage>
MainPage.xaml.cs
public partial class MainPage : ContentPage
{
public MainPageViewModel thisVm;
public MainPage()
{
InitializeComponent();
thisVm = ((MainPageViewModel)BindingContext);
thisVm.SetupMap();
}
}
MainPageViewModel
public class MainPageViewModel : BaseViewModel
{
private Map _map;
public Map Map
{
get { return _map; }
set
{
_map = value;
OnPropertyChanged();
}
}
public void SetupMap()
{
// Create a new map with a 'topographic vector' basemap.
Map = new Map(BasemapStyle.ArcGISTopographic);
}
}
When I am trying to run thi46application in UWP with x64/x86 setup it gives this error. Anyone know how to fix this?
System.BadImageFormatException
HResult=0x80131058
Message=Could not load file or assembly 'Esri.ArcGISRuntime, Version=100.13.0.0,
Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'. Reference assemblies should not be loaded for
execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
Source=ArcGis_POC
I have also tried to install Esri.ArcGISRuntime.UWP in UWP project individually but it also gives this error
Severity Code Description Project File Line Suppression State
Error NU1202 Package Esri.ArcGISRuntime.UWP 100.13.0 is not compatible with uap10.0.16299
(UAP,Version=v10.0.16299) / win10-arm64-aot. Package Esri.ArcGISRuntime.UWP 100.13.0
supports: uap10.0.18362 (UAP,Version=v10.0.18362)
In Android it runs but shows blank white screen.
Nugets I'm using:
:white_check_mark: Esri.ArcGISRuntime.Xamarin.Forms (100.13.0) :white_check_mark: Xamarin.Forms (5.0.0.2291) :white_check_mark: Xamarin.Essentials (1.7.0) :white_check_mark: NETStandard.Library (2.0.3)
@divyesh008
For this I have created new project in Xamarin.Forms
Which project template did you start with in Visual Studio?
I have also tried to install Esri.ArcGISRuntime.UWP in UWP project individually but it also gives this error
Error NU1202 Package Esri.ArcGISRuntime.UWP 100.13.0 is not compatible with uap10.0.16299
That error indicates the minimum platform version in your UWP project is too low. The minimum is 18362: Package Esri.ArcGISRuntime.UWP 100.13.0 supports: uap10.0.18362 (UAP,Version=v10.0.18362)
For more info see: https://docs.microsoft.com/en-us/windows/uwp/updates-and-versions/choose-a-uwp-version https://developers.arcgis.com/net/reference/system-requirements/#uwp-requirements-1