Select to view content in your preferred language

Unable to initialize .net WPF Runtime/Maps SDK 200 when deploying via MSIX / .net6

1264
7
Jump to solution
04-13-2023 09:55 AM
Labels (2)
CameronCross
New Contributor

I have a working WPF application and deployment that is currently on .net framework 4.8 / ArcGIS Runtime 100.15.  I'm upgrading it to .net 6 and ArcGIS Runtime 200, but am having issues with the deployment of the application.  

Specifically, there appear to be changes to how the MSIX package is being built and the deployment is no longer able to load the ArcGIS runtime.  It now fails with the following error: 


'Could not load ArcGIS Runtime (RuntimeCoreNet200_0.dll) or one of its dependencies. Ensure "Microsoft Visual C++ 2015-2022 Redistributable" is installed.'

I have attached a test project that demonstrates the issue, but here are a summary of issues: 

  1. VC++ redist central deployment via MSIX package dependency
    1. ESRI documentation for system requirements states that the minimum version of the VC++ redistributable is 14.32.31326  (https://developers.arcgis.com/net/reference/system-requirements/), however I'm not able to install that version of VCLibs using MSIX's package dependency.  The following error is produced when attempting to do that: 
      1. App installation failed with error message: Windows cannot install package b87957eb-eedf-485f-8f6d-0c9374efe8b8_1.0.0.0_x86__pj3157xj7x92a
        because this package depends on a framework that could not be found. Provide the framework "Microsoft.VCLibs.140.00.UWPDesktop" published by
        "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x86 processor architecture and minimum
        version 14.32.31326.0, along with this package to install. The frameworks with name "Microsoft.VCLibs.140.00.UWPDesktop" currently installed
        are: {Microsoft.VCLibs.140.00.UWPDesktop_14.0.30704.0_x64__8wekyb3d8bbwe Microsoft.VCLibs.140.00.UWPDesktop_14.0.30704.0_x86__8wekyb3d8bbwe}
        (0x80073cf3)
  2. VC++ redistributable via local deployment
    1. In our existing package, the ArcGIS native dlls are output into the ArcGISRuntime100.15\client32 and ArcGISRuntime100.15\client64 directories of the build output directory.  
    2. After migrating to .net6/ArcGISRuntime200, the client64 and client32 directories are no longer being created.  In addition, the MSIX package output directory does not align with the structure that is defined in the WPF targeting .net6 documentation here: https://developers.arcgis.com/net/license-and-deployment/deployment/#runtime-dlls-and-resources-for-...
    3. The attached project uses the win-x86 and win-x64 architecture specific runtime identifiers, but none of the sub directories listed in the document are created.

Our preference would be to use central deployment for the VC++ redist dependency, but could do local deployment if necessary.  At any rate, we have the following questions: 

  1. How can we reference the required (14.32.31326) version of the VC++ redist as a MSIX package dependency? 
  2. What VC++ redist files are required if doing the local deployment approach and where should they be placed in the final MSIX package? 
  3. Do the ArcGIS native dlls previously found in bin\ArcGISRuntime100.15\client32 and bin\ArcGISRuntime100.15\client64 need to be present to load the runtime?  If so, how do we force MSIX to include them? 

Thanks!

Cameron

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

Yes .NET 6 does native libraries a little different, since it now has first class support for native runtime libraries.
If you want an installer that'll install on both x86 and x64, you can use the app bundles in the MSIX publishing:

dotMorten_esri_1-1683042888477.png

Were you also using an MSIX installer in your .NET Framework app?

View solution in original post

0 Kudos
7 Replies
dotMorten_esri
Esri Notable Contributor

The attached project uses the win-x86 and win-x64 architecture specific runtime identifiers,

v200 requires the runtime identifiers to be win10-x86, win10-x64 and/or win10-arm64.

> After migrating to .net6/ArcGISRuntime200, the client64 and client32 directories are no longer being created.

.NET 6 does this differently. If you build an any-cpu app, they'll be in the \runtimes\[runtime-identifier] folder, but once you go to publishing where you'll be using a specific runtime identifier, these goes in the application root (and the architectures that doesn't apply will be skipped).

I'm not sure which UWP VSIX you're trying to take a dependency on. This isn't a UWP app. As long as you have the vclibs installed on your system, you should be good to go. The requirement is the same as it was with your WPF .NET Framework app.

Note that the error you're getting about VCLibs is just one potential problem. The error is stating it couldn't load the native ArcGIS Runtime assemblies. One reason for that could be that you don't have the right vclibs installed on the system, but in this case the more likely reason is the runtimecorenet.dll and RuntimeCoreNet200_0.dll are completely missing, due to the wrong runtime identifier being used (v200.1 will have a proper build error warning you about that).

0 Kudos
CameronCross
New Contributor

Thanks for the quick reply @dotMorten_esri 

v200 requires the runtime identifiers to be win10-x86, win10-x64 and/or win10-arm64.

Are these the only runtime identifiers that can be assigned for a WPF project?  When I remove the win-x86 and win-x64 runtime identifiers, I encounter the following build errors when trying to build the MSIX package: 

Esri.Runtime200.Msix.WpfClient\obj\project.assets.json' doesn't have a target for 'net6.0-windows10.0.19041.0/win-x64'. Ensure that restore has run and that you have included 'net6.0-windows10.0.19041.0' in the TargetFrameworks for your project. You may also need to include 'win-x64' in your project's RuntimeIdentifiers.

I have run nuget restore, but can only get the build error to go away by adding the win-x64 runtime identifier.  

.NET 6 does this differently. If you build an any-cpu app, they'll be in the \runtimes\[runtime-identifier] folder, but once you go to publishing where you'll be using a specific runtime identifier, these goes in the application root (and the architectures that doesn't apply will be skipped).

I do see the runtimes folder in the build output directory, but it is not included when MSIX packages everything up.  

> I'm not sure which UWP VSIX you're trying to take a dependency on. This isn't a UWP app.

In terms of referencing the VCLibs, we're adding them as a package dependency as is outlined here: 

Please let us know if there is a different way that we should be pulling in the VCLibs dependency using MSIX.  Our preference is to have MSIX pull down and install the appropriate VCLibs dependency when the installer runs rather than taking the local deployment approach where we copy the VC++ redist dlls into the output directory. 

0 Kudos
CameronCross
New Contributor

@dotMorten_esri , I'm not seeing the Any CPU behavior you described here: 

If you build an any-cpu app, they'll be in the \runtimes\[runtime-identifier] folder, but once you go to publishing where you'll be using a specific runtime identifier, these goes in the application root (and the architectures that doesn't apply will be skipped).

I published the ESRI WPF sample project (https://github.com/Esri/arcgis-maps-sdk-dotnet-samples) as Any CPU (after adding a publish profile for Any CPU).  Those folders are not included and I'm not able to launch the app after install (same failure message as above).  Attached are screenshots of the package contents.

Does the ArcGIS Runtime 200 support publishing as Any CPU?  If so, what are the required publish profile properties in order to achieve the Any CPU behavior that you described? 

0 Kudos
dotMorten_esri
Esri Notable Contributor

> after adding a publish profile for Any CPU

I'm not quite following this step. When you create a publishing profile you're supposed to pick win10-x86, win10-x64 or win10-arm64. When I said "Any CPU" I mean the normal build/run that doesn't go through the publishing step.

0 Kudos
CameronCross
New Contributor

Prior to upgrading to .net6, our build pipeline built the app as any cpu.  We have a publishing project that runs via a subsequent build step using msbuild command line parameters.  The net result of that step was a single MSIX file that had both the client32 and client64 runtime subdirectories included. 

After upgrading to .net6 / runtime 200, I can no longer package our app as we did previously.  Based on your comments, it appears that's expected, but has impacts for how we deploy our apps. 

0 Kudos
dotMorten_esri
Esri Notable Contributor

Yes .NET 6 does native libraries a little different, since it now has first class support for native runtime libraries.
If you want an installer that'll install on both x86 and x64, you can use the app bundles in the MSIX publishing:

dotMorten_esri_1-1683042888477.png

Were you also using an MSIX installer in your .NET Framework app?

0 Kudos
CameronCross
New Contributor

Yes, we were using MSIX in our .net framework app as well.  Thanks for the info on the app bundles.  It seems like that's what we're looking for.  I appreciate the help. 

0 Kudos