SharpClaw.Modules.Hosting 0.1.3-alpha

This is a prerelease version of SharpClaw.Modules.Hosting.
dotnet add package SharpClaw.Modules.Hosting --version 0.1.3-alpha
                    
NuGet\Install-Package SharpClaw.Modules.Hosting -Version 0.1.3-alpha
                    
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="SharpClaw.Modules.Hosting" Version="0.1.3-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpClaw.Modules.Hosting" Version="0.1.3-alpha" />
                    
Directory.Packages.props
<PackageReference Include="SharpClaw.Modules.Hosting" />
                    
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 SharpClaw.Modules.Hosting --version 0.1.3-alpha
                    
#r "nuget: SharpClaw.Modules.Hosting, 0.1.3-alpha"
                    
#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 SharpClaw.Modules.Hosting@0.1.3-alpha
                    
#: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=SharpClaw.Modules.Hosting&version=0.1.3-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SharpClaw.Modules.Hosting&version=0.1.3-alpha&prerelease
                    
Install as a Cake Tool

SharpClaw.Modules.Hosting

SharpClaw.Modules.Hosting is for host and runtime code that loads compiled SharpClaw .NET module assemblies. Its ModuleLoadContext creates a collectible assembly load context for one module entry DLL, resolves that module's private dependencies from the module folder, and keeps host-owned contract assemblies in the default load context so module objects can still be cast to the host's SharpClaw contract interfaces.

Reference this package when you are writing a SharpClaw host, gateway, test harness, or runtime adapter that needs to load a module DLL from disk. A normal module implementation usually references SharpClaw.Contracts for ISharpClawCoreModule and related DTOs; it only needs this package when it is itself responsible for loading another module assembly.

The smallest host-side shape is to create one load context for the module entry assembly, load the assembly through that context, and then find the module type using the shared contract interfaces already loaded by the host.

using System.Reflection;
using SharpClaw.Contracts.Modules;
using SharpClaw.Modules.Hosting;

var entryAssemblyPath = Path.Combine(moduleDirectory, "MyModule.dll");
var loadContext = new ModuleLoadContext(entryAssemblyPath);
var assembly = loadContext.LoadFromAssemblyPath(Path.GetFullPath(entryAssemblyPath));

var moduleType = assembly.GetTypes()
    .Single(type => type.IsAssignableTo(typeof(ISharpClawCoreModule)) && !type.IsAbstract);

Use a separate ModuleLoadContext for each loaded module instance. When the module is unloaded, release references to objects and types from that assembly before calling Unload; the runtime can only collect the context after those references are gone.

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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SharpClaw.Modules.Hosting:

Package Downloads
SharpClaw.Modules.DotNetSidecarHost

Runs compiled SharpClaw .NET modules as sidecar processes over the SharpClaw foreign-module protocol.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.3-alpha 61 7/5/2026
0.1.2-alpha 44 7/5/2026
0.1.1-alpha 49 7/5/2026
0.1.0-alpha 61 7/4/2026