Concepts

The Komod package

The installable unit is the .komod file: a zip. A package contains one or more Komods, and optionally a browser UI.

komod.json            manifest (generated by the build / kofa-pack)
server/*.dll          server assemblies and their private dependencies
client/*.dll          optional: Blazor UI assemblies
wwwroot/              optional: static files (JS module, CSS, image), README

Identification and version

Field Rule
Package id (KomodPackageId) Lowercase, separated by dots or hyphens, stable (e.g. acme.demo.thermostat).
Version (KomodPackageVersion) SemVer. Raise it for every release. Reloading the same version counts as a reinstall, and the Komod store does not replace an already published version.
Komod id ([Komod("…")]) The id of the Komods inside the package. Must not change between versions.

These are in Package.props, shared by the server and the UI project. For Acme.Demo.Thermostat the template creates this:

<Project>
  <!-- Package identity, shared by the server and the UI project. Bump KomodPackageVersion for every release. -->
  <PropertyGroup>
    <KomodPackageId>acme.demo.thermostat</KomodPackageId>
    <KomodPackageVersion>1.0.0</KomodPackageVersion>
    <KomodDisplayName>Termosztát</KomodDisplayName>
    <KomodDescription>Hiszterézises termosztát: a hőmérséklet alapján kapcsolja a fűtést.</KomodDescription>
    <Authors>Acme Kft.</Authors>
    <!-- UI assemblies in load order (their private dependencies first). -->
    <KomodClientAssemblies>&quot;Acme.Demo.Thermostat.Ui.dll&quot;</KomodClientAssemblies>
    <!-- Kofa.Abstractions NuGet version. -->
    <KofaSdkVersion>0.0.0-kofa-sdk</KofaSdkVersion>
  </PropertyGroup>
</Project>

Loading and hot reload

  • Every (package, version) pair goes into its own unloadable load context, so a package can be installed, updated and removed at run time without restarting the server.
  • On an update the instances restart one by one on the new version; their settings and links in the graph are kept.
  • Kofa.Abstractions* and the KOFA framework come from the host, so the types are shared between Komods. Do not (and must not) copy them into the package; the build leaves them out automatically.
  • The browser part (client/*.dll) is loaded in the browser when it is opened. WebAssembly has no unload: a changed UI dll with the same version takes effect only after a page refresh.

Dependencies

Your own NuGet packages and project references go next to the package. What the host already contains is left out: Kofa.Abstractions*, System.*, Microsoft.Extensions.*, Microsoft.AspNetCore.*, Microsoft.JSInterop, Microsoft.FluentUI.*. The UI project's own dependencies must also be listed in KomodClientAssemblies, in load order (the dependency first). Native libraries: Native dependencies.

Security and checks

  • Only an Admin can install. A SHA-256 hash is made of the package, and the preview shows it before the installation.
  • kofa-pack checks the package: it loads it, reads the Komods and ports, and warns if the UI refers to a framework assembly that is not complete in the released (trimmed) client (that would cause a MissingMethodException at run time).

Size and trimming

The released version of the browser client is trimmed: not every .NET framework API is available in the UI code. The common ones (System.Linq, System.Text.Json, collections, the Blazor components) are. If the UI uses something that is missing, kofa-pack warns; then avoid that API, or implement it on the server side and query it as a command. Single members can be missing inside an assembly too (e.g. some methods of Uri); the program export (Lite) checks the UI member by member against its runtime's client and names the missing type or member.