BlazorPluginComponents is a demonstration project showing how to dynamically load Razor Class Library (RCL) components in a Blazor Server application without registering them at compile time. Load components and full pages as runtime plugins — no project reference needed.
- Dynamic component loading — Load RCL components at runtime from DLL/assets without a project dependency
- 4 loading strategies — Standard project reference, folder-based loading, manual file upload, and NuGet Package (Module Manager)
- Module Manager — Upload a
.nupkgfile once; the server caches it and serves the component on demand - Dynamic page loading — Load entire Blazor pages dynamically through the Module Manager
- Blazor Server — Works with Blazor Server (hosted model)
A Razor Class Library (RCL) published via dotnet publish or dotnet pack produces:
| Artifact | Description |
|---|---|
*.dll + *.pdb |
Assembly and debug symbols |
wwwroot/ assets |
Isolated CSS, JavaScript, images |
*.nupkg |
All-in-one NuGet package (via dotnet pack) |
The project demonstrates 4 ways to consume these artifacts at runtime:
- Standard — Project reference (compile-time, for baseline comparison)
- Folder-based — Copy RCL files to a folder under
wwwroot, load dynamically - Manual upload — Upload DLL + assets via the app's UI
- Module Manager — Upload the
.nupkgonce, the server extracts and caches everything
- .NET 6+ SDK
- Git
# Clone the repository
git clone https://github.com/phmatray/BlazorPluginComponents.git
cd BlazorPluginComponents
# Build RazorClassLibrary2 first (post-build step copies assets to Server/wwwroot)
dotnet build RazorClassLibrary2/RazorClassLibrary2.csproj
# Run the server
dotnet run --project Server/BlazorPlugin2.Server.csproj
⚠️ BuildRazorClassLibrary2before the server project — its post-build command copies component assets toServer/wwwroot. Skipping this step will cause a runtime error.
Dynamic component loading from an RCL folder:
Dynamic page loading via Module Manager:
Explore each project in the solution to understand each loading strategy:
| Project | Strategy |
|---|---|
RazorClassLibrary1 |
Standard (compile-time reference) |
RazorClassLibrary2 |
Folder-based (post-build copy) |
RazorClassLibrary3 |
Manual upload / Module Manager |
Server |
Host application |
Pull requests welcome. Fork the repo, create a branch from master, and open a PR. For large changes, open an issue first.
MIT — see LICENSE

