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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sandhiya PriyaRank #26 · 43.2K reputationPosted Dec 22, 2025, 11:27 PM EST
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
Sanwar RanwaRank #23 · 44.7K reputationPosted Jan 18, 2020, 12:27 PM EST
Cynthia SathuragiriRank #937 · 2.2K reputationPosted Dec 11, 2025, 6:13 AM EST
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.