Skip to main content

Embedding libraries that include WPF user controls

Overview

In Next Design, in order to allow extensions to use newer versions of libraries than those referenced by the Next Design main body, libraries are loaded into different areas on an extension-by-extension basis.
However, depending on the library, loading it into a different area may affect operation.

For example, if a library uses a user control with screen drawing provided by WPF (Windows Presentation Foundation) and the library is loaded into a different area on an extension-by-extension basis, the following problem phenomenon has been confirmed to occur.

  • If a control that is commonly used by multiple extensions is displayed alternately in each extension, it will fail to display from the second time onwards.

To avoid such problems, we provide a mechanism that allows libraries to be loaded into the same area as the Next Design main body (this is called the default area) and shared.

Specifying shared libraries

You can specify in the manifest to load WPF libraries, etc. into the default area. A library that is specified to be loaded in the default area is called a shared library. To specify a shared library, write the following in the manifest.

  • The library path is specified using a relative path from the manifest file.
manifest.json
{
"runtime": {
"sharedAssemblies": [
{
"path": "NextDesign.CustomUI.DataGrid.dll"
},
{
"path": "mySubDir/NextDesign.CustomUI.Dialogs.dll"
}
]
}
}
  • Wildcards ("*") can be specified in the path. However, wildcards are only valid within the same folder.
manifest.json
{
"runtime": {
"sharedAssemblies": [
{
"path": "NextDesign.CustomUI.*.dll"
},
{
"path": "SomeUILib.*.dll"
},
{
"path": "NextDesign.*.SomeLib.*.dll" //Multiple wildcards can also be used.
}
]
}
}

Notes

If an assembly referenced by an extension is not specified as a shared library, it will be loaded as a non-shared library. If an assembly is specified as a shared library, not only that assembly but also all assemblies referenced by that assembly will be loaded as shared libraries.
And if a non-shared library and a shared library reference the same assembly, the same assembly will be loaded twice under separate memory management. In this state, even if the same type is defined in the same assembly, a runtime error may occur, such as not being found under the memory management of the other.
For extensions that reference such assemblies, including extensions that use WPF, specify all applicable assemblies in the shared library.

For information on loading assemblies referenced by extensions, please also see the following page.

Reference > Extension Loading Mechanism