Skip to main content

Include a library containing WPF user controls

preview released

This function and the API used in this function have been released in advance. We do not guarantee the quality at this time, so if you use it, please use it at your own risk. Also, please note that these specifications are subject to change without notice.

Overview

In V2.0, libraries are loaded in different areas for each extension so that extensions can use newer versions of libraries than those referenced by Next Design itself.
However, some libraries may affect behavior by being loaded in different regions.

For example, if a user control with screen drawing provided by WPF (Windows Presentation Foundation) is used in a library, and the library is loaded in different areas for each extension, the following problems occur. has been confirmed.

  • If you alternately display controls that are commonly used by multiple extensions in each extension, the second and subsequent displays will fail.

To avoid such problems, we provide a mechanism to load and share the library in the same area as Next Design itself (this is called the default area).

info

To use this mechanism, please upgrade to Next Design V2.0 Service Update 1 or later.

Specify shared library

You can specify in the manifest to load WPF libraries etc. in the default area. Libraries that are specified to be loaded into the default region are called shared libraries. To specify a shared library, put the following in your manifest:

  • Specify the path of the library as a relative path from the manifest file.
manifest.json
{
"runtime": {
"sharedAssemblies" : [
{
"path" : "NextDesign.CustomUI.DataGrid.dll"
},
{
"path" : "mySubDir/NextDesign.CustomUI.Dialogs.dll"
}
]
}
}
  • A wildcard ("*") can be specified for the path. However, wildcards are valid only within the same folder.
manifest.json
{
"runtime": {
"sharedAssemblies" : [
{
"path" : "NextDesign.CustomUI.*.dll"
},
{
"path" : "SomeUILib.*.dll"
},
{
"path" : "NextDesign.*.SomeLib.*.dll" //Can also target multiple wildcards.
}
]
}
}

Loading shared libraries

Next Design traverses the manifests of all active extensions1 regardless of lifecycle to determine which libraries are designated as shared libraries. At this time, if different versions of the same library are specified as shared libraries for each extension, the library with the latest file version among those libraries will be loaded.
With this mechanism, even extensions with older version libraries will use the latest libraries located in other extension folders.

Also, for the culture (resource), load the resource library for the culture of the Next Design body 2. At this time, subfolders such as ja and en in the same folder as the library loaded as a shared library are searched.

about shared library search paths
  • The extension shared library is searched from the folder under the extension execution folder.
    However, folders (and their subfolders) that meet the following conditions are excluded from search targets.
    • Folder whose name starts with "."
    • Folder containing executable files (*.exe)

Notes

If some extensions specify the same library as a shared library and some extensions do not, all extensions use the shared library.

  • At this time, the library with the latest file version among the extension libraries specified as shared libraries will be loaded.
  • Therefore, even if a new version of the library is placed with an extension that is not specified as a shared library, the corresponding library will not be loaded.
About resolving shared library versions

This mechanism allows bugfixes and the latest features to be available even for extensions with older versions of the library.
On the other hand, extensions configured with older versions of the library may cause run-time errors if the library in question does not guarantee backward compatibility.

If you give a shared library the ability to dynamically load assemblies through reflection, all dynamically loaded assemblies and any assemblies referenced by that assembly are also shared libraries.

  • Assemblies referenced in an extension but not specified as shared libraries are non-shared libraries, but dynamically loading the same assemblies from a shared library will load them in the shared library as well.
  • This can lead to run-time errors such as not finding types defined in that assembly.

If you have such assemblies, mark them all as shared libraries.

Restrictions

  • A native library cannot be specified as a shared library. Configure shared libraries so that they do not contain native libraries.
  • Libraries referenced by Next Design itself cannot be specified as shared libraries. Define the manifest so that the library referenced by Next Design itself is not specified as a shared library.

Precautions for specification and maintenance when referencing assemblies

The versions that can be referenced are limited as follows, depending on whether or not sharing is necessary and whether or not NextDesign is included.
It also summarizes points to note such as compatibility with other extensions.

Whether it is shared with other extensionsWhether it is included in NextDesignWhether or not a shared library is specifiedReferenceable versionNotes during developmentNotes during maintenance
ShareBundledNotSame version as NextDesignNone*1
Not includedYesAny version*2*3
Not sharedBundledNoSame or newer version than NextDesign*4*5
Not includedNotAny version*4*5
    1. When NextDesign is upgraded and the assembly version is changed, please confirm that the new version will work correctly.
    1. If it is specified as a shared library in other extensions, please confirm that it works correctly with the newer version.
    1. When NextDesign is upgraded and the assembly is included in NextDesign, please confirm that it works correctly with that version. If it is specified as a shared library in other extensions, make sure that it works correctly when the reference version of that extension is changed.
    1. If it is specified as a shared library in another extension, please confirm that it works properly with that version, or specify it as a shared library.
    1. When NextDesign is upgraded and the version of the assembly is changed or the reference version of other extensions is changed, please confirm that the new version will work correctly. If it is specified as a shared library in another extension, make sure that it works correctly when the reference version of that extension is changed.

Footnotes

  1. Extensions that have not been disabled in Next Design's manage extensions.

  2. The resource library does not need to be specified as a shared library in the manifest.