This guide will walk you through setting up your development environment, creating your first module, and running it in the Modulus host.
- .NET 10 SDK or later
- IDE: Visual Studio 2022, JetBrains Rider, or VS Code
- Git (optional, for cloning the repository)
# Install the Modulus CLI globally
dotnet tool install -g Agibuild.Modulus.Cli
# Verify installation
modulus --help# Install module project templates
dotnet new install Agibuild.Modulus.Templates
# Verify templates are installed
dotnet new list modulusYou should see:
Template Name Short Name Language Tags
--------------------------- ---------------- -------- --------------------------------
Modulus Module (Avalonia) modulus-avalonia [C#] Modulus/Module/Plugin/Avalonia
Modulus Module (Blazor) modulus-blazor [C#] Modulus/Module/Plugin/Blazor
# Clone the repository
git clone https://github.com/AGIBuild/Modulus.git
cd Modulus
# Build the solution
dotnet build
# Run the Avalonia host
dotnet run --project src/Hosts/Modulus.Host.AvaloniaUsing the CLI:
modulus new -n MyFirstModule
cd MyFirstModuleOr using dotnet new:
dotnet new modulus-avalonia -n MyFirstModule
cd MyFirstModuleThis creates a module with the following structure:
MyFirstModule/
├── MyFirstModule.sln # Solution file
├── .gitignore
├── Directory.Build.props # Generated to reference Modulus assemblies from the CLI installation
├── extension.vsixmanifest # Module manifest
├── MyFirstModule.Core/ # Core logic (host-agnostic)
│ ├── MyFirstModule.Core.csproj
│ ├── MyFirstModuleModule.cs # Module entry point
│ └── ViewModels/
│ └── MainViewModel.cs # Main ViewModel
└── MyFirstModule.UI.Avalonia/ # Avalonia UI
├── MyFirstModule.UI.Avalonia.csproj
├── MyFirstModuleAvaloniaModule.cs
├── MainView.axaml # UI definition
└── MainView.axaml.cs
modulus buildOr:
dotnet buildmodulus packThis creates a .modpkg file in the ./output/ directory.
modulus install ./output/MyFirstModule-1.0.0.modpkg# If you have the Modulus host installed
modulus-host
# Or run from the Modulus source
dotnet run --project path/to/Modulus/src/Hosts/Modulus.Host.AvaloniaYour module will appear in the sidebar!
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Create │────▶│ Build │────▶│ Pack │
│ modulus new │ │modulus build│ │ modulus pack│
└─────────────┘ └─────────────┘ └─────────────┘
│
▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Run │◀────│ Install │◀────│ Output │
│ Host App │ │modulus inst.│ │ .modpkg │
└─────────────┘ └─────────────┘ └─────────────┘
Contains the business logic, ViewModels, and services. This code is host-agnostic and runs on both Avalonia and Blazor hosts.
Key files:
*Module.cs: The module entry point, extendsModulusPackageViewModels/: MVVM ViewModels for your moduleServices/: Business logic services (you add these)
Contains the UI implementation for each host platform.
- Avalonia: Uses
.axamlfiles for XAML-based UI - Blazor: Uses
.razorfiles for component-based UI
The manifest file is automatically generated by the template and contains:
<PackageManifest Version="2.0.0">
<Metadata>
<Identity Id="unique-guid" Version="1.0.0" Publisher="YourName" />
<DisplayName>MyFirstModule</DisplayName>
<Description>Module description</Description>
</Metadata>
<Assets>
<!-- Module assemblies -->
<Asset Type="Modulus.Package" Path="MyFirstModule.Core.dll" />
<!-- Host-specific UI packages -->
<Asset Type="Modulus.Package" Path="MyFirstModule.UI.Avalonia.dll" TargetHost="Modulus.Host.Avalonia" />
<Asset Type="Modulus.Package" Path="MyFirstModule.UI.Blazor.dll" TargetHost="Modulus.Host.Blazor" />
<!-- Menu declarations are NOT in the manifest anymore.
Menus are declared via [AvaloniaMenu]/[BlazorMenu] on the host-specific module entry type
and projected to the database at install/update time. -->
</Assets>
</PackageManifest>| Command | Description |
|---|---|
modulus new |
Create a new project (module or host app) |
modulus build |
Build the module in current directory |
modulus pack |
Build and package as .modpkg |
modulus install <source> |
Install a module from .modpkg or directory |
modulus uninstall <name> |
Uninstall a module |
modulus list |
List installed modules |
# Avalonia desktop host app
modulus new avaloniaapp -n MyApp
# Blazor Hybrid (MAUI) host app
modulus new blazorapp -n MyAppNotes:
blazorappis a MAUI host template and typically requires Windows to build.
modulus build [options]
Options:
-p, --path <path> Path to module project
-c, --configuration <config> Build configuration (default: Release)
-v, --verbose Show detailed outputmodulus pack [options]
Options:
-p, --path <path> Path to module project
-o, --output <path> Output directory (default: ./output)
-c, --configuration <config> Build configuration (default: Release)
--no-build Skip build, use existing output
-v, --verbose Show detailed outputmodulus install <source> [options]
Arguments:
<source> Path to .modpkg file or module directory
Options:
-f, --force Overwrite existing installation
-v, --verbose Show detailed output- Module Development Guide - Deep dive into module development
- CLI Reference - Complete CLI command reference
- Host App Development Guide - Create and customize plugin-based host apps
Restart the Modulus host application. Modules are loaded at startup.
Ensure you have the latest Modulus SDK packages:
dotnet restoreCheck that your host-specific module entry type declares a menu attribute:
- Avalonia:
[AvaloniaMenu("key", "Display", typeof(MainViewModel), ...)] - Blazor:
[BlazorMenu("key", "Display", "/route", ...)]
Menus are read from the database at render time. If you upgraded from an older build, delete the host database file and restart.
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions