Select to view content in your preferred language

The 'Esri.ArcGISRuntime' nuget package cannot be used to target 'net7.0' for output type 'Exe'

2020
4
06-07-2023 10:15 PM
BrianLoehr
New Contributor

This error is being generated when I compile my xUnit project. The project compiled properly prior to adding the Esri.ArcGISRuntime.Toolkit.Maui package to my MAUI library that is being tested. 

I cannot figure out what it thinks is being compiled as an EXE. As stated above the xUnit project is referencing library projects, not EXE projects. I went so far as to unload the EXE project as well. The error still occurs.

Any ideas?

 

Thanks!

0 Kudos
4 Replies
dotMorten_esri
Esri Notable Contributor

Change the unit test project targetframework from "net7.0" to "net7.0-windows10.0.19041.0". 

BrianLoehr
New Contributor

Thanks for the tip @dotMorten_esri , but unfortunately it does not work for me. Were you able to make this work? There is an Open bug reported here on this: https://github.com/dotnet/maui/issues/11575

This is the same error message I receive when trying your suggestion. With the difference that it references net7.0 instead net6.0.

 

0 Kudos
dotMorten_esri
Esri Notable Contributor

The Maps SDK for .NET only supports the base .net7 target for class libraries. When you go to execute at runtime, it requires a platform identifier so the correct native libraries gets deployed and are available at runtime.

I'm guessing the issue you're referring to is related to that .NET MAUI deploys on Windows as a packaged app, and your test runner (and commandline parameters) must support this.
Which test framework are you using?

0 Kudos
BrianLoehr
New Contributor

I'm using XUnit and running the app within Visual Studio 2022 on Windows 11. Typically I run the tests through Resharper. But Microsoft Test gives the same error.

0 Kudos