+++ title = "Plugin-Based Web Application in Dotnet" date = "2024-01-20T00:00:00+00:00" author = "the1mason" authorTwitter = "the0mason" #do not include @ cover = "posts/modular-app/title.svg" tags = ["dotnet", "web", "prototype"] keywords = ["prototype", "dotnet", "guide", "plugins", "plugin-based", "web application", "ASP.NET", "C#", ".NET 8", "Programming", "Software Architecture"] description = "Have you ever thought about making a web application, that could be easily extended by third-party developers? I've been thinking about making this app for a while, so here's my experience..." showFullContent = false readingTime = true hideComments = false draft = false +++ ### Table of Contents - [Introduction](#introduction) - [Why](#why) - [How](#how) - [The Prototype](#the-prototype) - - [IPlugin](#iplugin) - - [Loading Plugins](#loading-plugins) - - [Hooks and Triggers](#hooks-and-triggers) - [Sources](#sources) # Introduction This post is about my experience of making a prototype of a web app with plugin support as well as my reasoning. As a result, this app could be extended by adding compiled `.dll` class libraries into a plugins folder. I've made it possible to load not only classes but also views and API controllers. You can check out the final version of this prototype in this [GitHub Repo](//github.com/the1mason/prototype.modularmvc). Also right now I'm building a web application, using similar concepts. As of now, it's not on github, but you can find it [here](//git.the1mason.com/the1mason/octocore).
# Why Self-hosted web applications can solve different problems and be of use to a variety of different people with slightly different needs. For this to work, I think that such an application should provide an option to extend its functionality. This would allow other people to build an ecosystem of different extensions. # Stack  Do you speak *CSharp*? I do. It's my main language after all, but why MVC and what is HTMX? Let's have a quick look at worthy alternatives, and then I'll explain my choices. `Blazor WASM` does not support runtime assembly loading, which makes client extension impossible. It has [Lazy loading](https://learn.microsoft.com/en-us/aspnet/core/blazor/webassembly-lazy-load-assemblies?view=aspnetcore-8.0), but it still requires these assemblies to be defined in the project file, which is not viable for our case. `WebApi +