100.10 ArcGISRuntime.WPF.Viewer.NetCore won't compile with net5.0-windows

2169
4
Jump to solution
01-28-2021 09:57 AM
KirkKuykendall1
Occasional Contributor III

Hi -

Is anyone able to get the sample ArcGISRuntime.WPF.Viewer.NetCore.csproj for 100.10 to compile with .net 5.0?

With <TargetFramework>net5.0-windows</TargetFramework>, I get this error:

 

Error The 'Esri.ArcGISRuntime.Hydrography' nuget package cannot be used to target 'net5.0-windows'. Target 'net5.0-windows10.0.18362.0' or higher instead. 

 

So I updated to <TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>, but now I get this:

Error XDG0008 The name "Map" does not exist in the namespace "http://schemas.esri.com/arcgis/runtime/2013". ArcGISRuntime.WPF.Viewer.NetCore D:\repos\esri\arcgis-runtime-samples-dotnet\src\WPF\ArcGISRuntime.WPF.Viewer\Samples\Layers\ArcGISMapImageLayerUrl\ArcGISMapImageLayerUrl.xaml 

Thanks, Kirk

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

FYI made a PR to address these remaining issues, so you can pull that until it's been merged:
https://github.com/Esri/arcgis-runtime-samples-dotnet/pull/851

View solution in original post

4 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi Kirk,

What happens when you target `net5.0-windows10.0.18362.0`?

0 Kudos
KirkKuykendall1
Occasional Contributor III

Hi Michael -

Sorry, shoulda mentioned I get the same thing.

I'm running Microsoft Windows [Version 10.0.19042.746], and on this page it says 

KirkKuykendall1_0-1611857494706.png

So I figured I'd use net5.0-windows10.0.19041.0.

Same results with either one though.

Thanks, Kirk

 

0 Kudos
dotMorten_esri
Esri Notable Contributor

This hydrography issue is a restore error. Try deleting the \obj\ folder and rebuild and this error will go away.

As you then found you will however after that see a few XAML compilation errors. In the .NET 5.0 build there isn't support for creating some of the objects in XAML with the default prefix. 
For example you will want to change esri:Map by registering the namespace using:
xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime"

and then change it to <mapping:Map />

This change has happened, because the Esri.ArcGISRuntime package no longer takes a dependency on WPF, and without that, we can't auto-register those namespaces for use by WPF. This is a current limitation in WPF, but hope to get this addressed with the PR to WPF I submitted here (feel free to upvote it help get support for it): https://github.com/dotnet/wpf/pull/3066

0 Kudos
dotMorten_esri
Esri Notable Contributor

FYI made a PR to address these remaining issues, so you can pull that until it's been merged:
https://github.com/Esri/arcgis-runtime-samples-dotnet/pull/851