How to generate Controller wise dll in ASP.NET With MVC
how counld i generate controller wise dll in ASP.NET MVC Solution
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandhiya PriyaPosted Dec 23, 2025, 4:27 AM
What “controller-wise DLL” usually means in real projects , It does NOT mean one DLL per controller class directly.
It means:
Grouping controllers by module / feature
Compiling each module into a separate Class Library (DLL)
Loading them into the main MVC application
Correct and Recommended Approach (Modular MVC)
Step 1: Create Class Library projects
Create separate Class Library projects for each module.
Example:
MyApp.Web (Main MVC project)
MyApp.AdminModule (DLL)
MyApp.ReportModule (DLL)
MyApp.UserModule (DLL)
Each module DLL will contain:
Controllers
Views (optional – handled separately)
Business logic
Step 2: Add MVC references to Class Library
In each module project:
Add reference to:
Microsoft.AspNetCore.Mvc (ASP.NET Core)
System.Web.Mvc (ASP.NET MVC 5)
Set controller classes as
public.Example (inside AdminModule DLL):
Step 3: Reference the DLL in Main MVC Project
In
MyApp.Web:Add reference to:
MyApp.AdminModule.dll
MyApp.ReportModule.dll
Now MVC can discover controllers from external DLLs.
Step 4: Enable Controller Discovery from DLLs
ASP.NET MVC automatically scans referenced assemblies.
No extra configuration needed if:
Controllers are public
Class names end with
ControllerAssembly is referenced
For ASP.NET Core:
Step 5: Handle Views (Important)
Controllers can be in DLLs, but Views cannot be embedded easily in MVC 5.
Common solutions:
Keep Views in main MVC project under:
/Views/Admin/Index.cshtmlOR use Razor Class Library (ASP.NET Core only)
Alternative: Area-based DLL separation (Most practical)
Instead of controller-wise DLL, use:
Area-wise DLL
Example:
Admin Area ? AdminModule.dll
Reports Area ? ReportModule.dll
This is clean, scalable, and enterprise-friendly.
When should you use controller-wise DLLs?
Use this approach when:
Large enterprise application
Multiple teams working independently
Plug-in based architecture
Need independent deployment/versioning
Do NOT use it for:
Small or medium projects
Simple CRUD apps
Beginners
Cynthia SathuragiriPosted Dec 11, 2025, 11:13 AM
You cannot generate controller-wise DLLs directly.
To do it, you must move each controller into its own Class Library project — each project builds its own DLL.
Sanwar RanwaPosted Jan 18, 2020, 5:27 PM