OpenShock.Desktop.ModuleBase 1.1.4

dotnet add package OpenShock.Desktop.ModuleBase --version 1.1.4
                    
NuGet\Install-Package OpenShock.Desktop.ModuleBase -Version 1.1.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OpenShock.Desktop.ModuleBase" Version="1.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenShock.Desktop.ModuleBase" Version="1.1.4" />
                    
Directory.Packages.props
<PackageReference Include="OpenShock.Desktop.ModuleBase" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OpenShock.Desktop.ModuleBase --version 1.1.4
                    
#r "nuget: OpenShock.Desktop.ModuleBase, 1.1.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OpenShock.Desktop.ModuleBase@1.1.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OpenShock.Desktop.ModuleBase&version=1.1.4
                    
Install as a Cake Addin
#tool nuget:?package=OpenShock.Desktop.ModuleBase&version=1.1.4
                    
Install as a Cake Tool

OpenShock Desktop Module Base

This module is the base for all OpenShock Desktop modules. It provides the basic structure and interfaces that all modules should implement.

Installation

dotnet add package OpenShock.Desktop.ModuleBase

Usage

You need to inherit the DesktopModuleBase class and add the DesktopModuleAttribute to your assembly.

A minimal module would look like this:

Note that the assembly attribute is needs to be outside a namespace to work.

using OpenShock.Desktop.ModuleBase;
using OpenShock.Desktop.ModuleBase.Navigation;

[assembly:DesktopModule(typeof(ExampleDesktopModule), "openshock.desktop.modules.examplemodule", "Example Module")]
namespace OpenShock.Desktop.Modules.ExampleModule;

public class ExampleDesktopModule : DesktopModuleBase
{
    public override IReadOnlyCollection<NavigationItem> NavigationComponents { get; } = [];
}

Or see the example module on how to use it.

Module Packaging (.module.zip)

Starting with OpenShock.Desktop.ModuleBase 1.1.3, the NuGet package ships MSBuild targets that automatically produce a ready-to-install *.module.zip bundle when you publish your module. Adding the package reference is enough — no extra tooling, no custom scripts.

How it works

On dotnet publish, the PackOpenShockModule target runs after Publish and writes <AssemblyName>.module.zip into the publish directory with this layout:

<AssemblyName>.dll                 # your module entry point (+ .pdb if present)
libs/
  *.dll                            # third-party deps the host does NOT already provide
  <rid>/…                          # native + RID-specific files copied from runtimes/

Assemblies the host already ships (MudBlazor, Serilog, the MAUI/Blazor stack, OpenShock SDKs, Microsoft.Extensions.*, etc.) are excluded automatically so your ZIP stays small and you don't risk loading a second copy at runtime. The authoritative list lives in OpenShock.Desktop.ModuleBase.targets as OpenShockHostAssembly items.

Opting in / out

Packaging is on by default once you reference the NuGet package. To disable it for a specific project, set:

<PropertyGroup>
  <OpenShockPackModule>false</OpenShockPackModule>
</PropertyGroup>

You can also customize:

Property Default Purpose
OpenShockModuleId $(AssemblyName) Stable module identifier used by the host. Set this to a reverse-DNS id like openshock.desktop.modules.mymodule.
OpenShockModuleOutputDir $(PublishDir) Where to drop the .module.zip.

Overriding a host-provided dependency

If your module genuinely needs a different version of something the host provides, force it to be bundled:

<ItemGroup>
  <OpenShockBundleOverride Include="Newtonsoft.Json" />
</ItemGroup>

The override will be copied into libs/ alongside your other dependencies. Use this sparingly — the host may still reject your module if the mismatch affects a type it hands you across the API boundary.

Shipping extra files (native sidecars, assets)

If your publish output contains directories you need at runtime (e.g. x64/ with native DLLs), list them with OpenShockExtraDir:

<ItemGroup>
  <OpenShockExtraDir Include="x64" />
</ItemGroup>

Each listed directory is copied under libs/<name>/… in the final ZIP.

Version-mismatch diagnostics (OSMOD001)

After publish, the target scans your deps.json and compares dependency versions against the host's declared versions. A major-version mismatch emits MSBuild warning OSMOD001 at build time, e.g.:

warning OSMOD001: Module references MudBlazor 8.0.0 but host provides 9.3.0.
Major version mismatch may cause runtime errors.

Treat these as real — major bumps across the host/module boundary almost always break at load time. Either align to the host version or force-bundle via OpenShockBundleOverride (and accept the duplication).

ProjectReference consumers

If you reference ModuleBase as a ProjectReference instead of a PackageReference (as the in-repo ExampleModule does), MSBuild does not auto-import the NuGet build/ assets. Add the imports manually at the top and bottom of the csproj:

<Import Project="../ModuleBase/build/OpenShock.Desktop.ModuleBase.props" />

<Import Project="../ModuleBase/build/OpenShock.Desktop.ModuleBase.targets" />

NuGet consumers get both imports for free.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.4 82 4/12/2026
1.1.3 91 4/11/2026
1.1.2 275 11/25/2025
1.1.0 397 8/15/2025
1.0.0 146 8/1/2025
1.0.0-preview.5 163 6/23/2025
1.0.0-preview.4 191 5/3/2025
1.0.0-preview.3 118 4/4/2025
1.0.0-preview.1 189 3/19/2025