This repository works on building a plugin architecture using ASP.NET boilerplate framework and angular 4+. It is the implementation of my idea discussed in this thread
- The backend (Host) plugin architecture system made use of the ASP.NET Boilerplate template.
- The frontend (UI) plugin is developed using multiple angular4+ applications. When the plugin is done, we need to compile and build the UI to get the minified js, html, css and assets files. Then, put the plugin-ui into the main ui wwwroot folder and use a hosting-server to run the UI. Then, voila, we can now use the plugin.
- Firstly, we need a json file that states the name of the plugin, the folder name that holds all the backend dlls, the suburl needed by the plugin. You can see example at /aspnet-core/Todo.DemoPlugin/Todo.DemoPlugin.Web.Core/Todo.Demoplugin.json
- We need to build the Angular UI, zip them, then embed into a plugin dll, which in our case is the *.Web.Core.dll, see: /aspnet-core/Todo.DemoPlugin/Todo.DemoPlugin.Web.Core/Todo.DemoPlugin.Web.Core.csproj
- After building the project, you can copy and paste a json file along with the *.dll files into
/aspnet-core/src/Todo.MainProject.Web.Host/PlugIns
- We can automate the process using powershell as shown in /aspnet-core/Todo.DemoPlugin/Todo.DemoPluginDeploy.ps1
- On the UI side, the main UI will automatically detect if there are any added plugin and download them. The downloader is written in C#. You can find it in
/plugin-downloader/
- After adding the plugin, whenever the plugin is updated, we just need to replace the *.dll.
- Setup the project accordingly according to the ASP.NET Boilerplate Documentation
- Install Yarn
- Has Powershell available.
- Navigate to
/aspnet-core
and openTodo.MainProject.sln
- Set
/src/Todo.MainProject.Web.Host
as StartUp project - **[First time only] Open
Package Manager Console
and runUpdate-Database
command to create your database (ensure that Default project is selected asTodo.MainProject.EntityFrameworkCore
in the Package Manager Console window). - Build & Run.
- Navigate to
/angular
and open apowershell
- **[First time only] Run
Yarn
- Run
ng build --prod
, then Rundotnet run
- Open your browser and navigate to http://localhost:4200
- Setup the project once: Ran
Update-Database
andYarn
- Run
addPlugin.ps1
located in the root level. - Now Run the Host then Run the UI
- Can we use
yarn start
ornpm start
instead of runningng build
anddotnet run
?- Running
yarn start
ornpm start
would not see the plugin, so, if you want to see the plugin, then no.
- Running
Special thanks to Aspnetboilerplate for their amazing work!
If you are interested in the template, please see: Aspnetboilerplate Template Readme