|
| 1 | +# CORE - Question 02 - Please tell me what is included in .Net and the reasons why some components aren't included in .Net Core? |
| 2 | + |
| 3 | +Understanding what's included in **.NET Framework** vs what's included (or excluded) in **.NET Core** (and now modern **.NET 5/6/7/8**) reveals a lot about the **goals, trade-offs, and evolution** of the platform. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## What’s Included in the Full .NET Framework? |
| 8 | + |
| 9 | +The original **.NET Framework** (1.0–4.8) is a **monolithic**, **Windows-only** platform that includes: |
| 10 | + |
| 11 | +### 🔹 1. **CLR (Common Language Runtime)** |
| 12 | + |
| 13 | +* Garbage Collection |
| 14 | +* JIT compilation |
| 15 | +* Code Access Security |
| 16 | +* Exception handling |
| 17 | +* Threading and synchronization |
| 18 | + |
| 19 | +### 🔹 2. **Base Class Library (BCL)** |
| 20 | + |
| 21 | +* `System`, `System.Collections`, `System.IO`, `System.Text`, etc. |
| 22 | + |
| 23 | +### 🔹 3. **Desktop UI Frameworks** |
| 24 | + |
| 25 | +* **Windows Forms (WinForms)** |
| 26 | +* **Windows Presentation Foundation (WPF)** |
| 27 | + |
| 28 | +### 🔹 4. **ASP.NET (Classic)** |
| 29 | + |
| 30 | +* Web Forms |
| 31 | +* ASP.NET MVC |
| 32 | +* ASP.NET Web API |
| 33 | + |
| 34 | +### 🔹 5. **Workflow & Communication** |
| 35 | + |
| 36 | +* **Windows Communication Foundation (WCF)** |
| 37 | +* **Windows Workflow Foundation (WF)** |
| 38 | + |
| 39 | +### 🔹 6. **Entity Framework (EF 6)** |
| 40 | + |
| 41 | +* Object-Relational Mapping (ORM) |
| 42 | + |
| 43 | +### 🔹 7. **Global Assembly Cache (GAC)** |
| 44 | + |
| 45 | +* Shared assemblies system-wide |
| 46 | + |
| 47 | +### 🔹 8. **Interop Support** |
| 48 | + |
| 49 | +* COM Interop |
| 50 | +* P/Invoke |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## Why Are Some Components **Not in .NET Core**? |
| 55 | + |
| 56 | +.NET Core (and later .NET 5/6/7/8) was **rewritten from scratch** with different design goals: |
| 57 | + |
| 58 | +* **Cross-platform support** |
| 59 | +* **Modularity** |
| 60 | +* **Performance and scalability** |
| 61 | +* **Cloud-readiness** |
| 62 | +* **Simplified development** |
| 63 | + |
| 64 | +So Microsoft **intentionally left out or redesigned** components that didn’t align with these goals. |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +## Components Not (or Initially Not) Included in .NET Core — And Why |
| 69 | + |
| 70 | +| Component / Feature | Included in .NET Core? | Reason for Exclusion or Replacement | |
| 71 | +| ---------------------------------- | ----------------------------- | -------------------------------------------------------------------------------------------- | |
| 72 | +| **Web Forms (ASP.NET)** | ❌ No | Tightly coupled to IIS and Windows UI model | |
| 73 | +| **WCF (Windows Comm. Foundation)** | ❌ No | Complex, SOAP-heavy; replaced by gRPC, REST | |
| 74 | +| **Windows Workflow (WF)** | ❌ No | Limited usage, heavyweight, not cross-platform | |
| 75 | +| **System.Drawing (GDI+)** | Partially (platform-specific) | Windows-only dependency, replaced by `System.Drawing.Common` then moved to `SkiaSharp`, etc. | |
| 76 | +| **WinForms / WPF** | ✅ Yes (but Windows-only) | Available in .NET Core 3.0+ but limited to Windows | |
| 77 | +| **Global Assembly Cache (GAC)** | ❌ No | GAC caused versioning/deployment issues; replaced by NuGet/local deployment | |
| 78 | +| **AppDomains** | ❌ No | Complex and unsafe isolation model; replaced by `AssemblyLoadContext` | |
| 79 | +| **Code Access Security (CAS)** | ❌ No | Obsolete; never worked well cross-platform | |
| 80 | +| **Remoting** | ❌ No | Insecure, complicated, and obsolete; replaced by modern communication models | |
| 81 | +| **Full Reflection.Emit** | Partially | Reflection.Emit support is limited on non-Windows platforms | |
| 82 | +| **Enterprise Services (COM+)** | ❌ No | Very Windows-specific; rarely used outside of legacy enterprise apps | |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## What's Included in .NET Core / .NET 5+? |
| 87 | + |
| 88 | +### Always Included (Cross-platform): |
| 89 | + |
| 90 | +* **CoreCLR** runtime |
| 91 | +* **Base Class Libraries (BCL)** |
| 92 | +* **ASP.NET Core** |
| 93 | +* **Entity Framework Core** |
| 94 | +* **gRPC, SignalR** |
| 95 | +* **LINQ, Span<T>, Memory<T>** |
| 96 | +* **Generic Host and Dependency Injection** |
| 97 | +* **NuGet packaging** |
| 98 | +* **System.Text.Json** |
| 99 | +* **System.IO.Pipelines** |
| 100 | +* **Self-contained deployment support** |
| 101 | + |
| 102 | +### Windows-only in .NET Core: |
| 103 | + |
| 104 | +* WinForms and WPF (starting in .NET Core 3.0) |
| 105 | +* COM Interop |
| 106 | +* System.DirectoryServices (partial support in .NET 7+) |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +## Example: WCF vs gRPC |
| 111 | + |
| 112 | +Instead of using WCF, .NET Core pushes modern technologies: |
| 113 | + |
| 114 | +### Old WCF: |
| 115 | + |
| 116 | +```csharp |
| 117 | +[ServiceContract] |
| 118 | +public interface IMyService |
| 119 | +{ |
| 120 | + [OperationContract] |
| 121 | + string GetData(int value); |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +### Modern .NET Core (gRPC or REST): |
| 126 | + |
| 127 | +```csharp |
| 128 | +[ApiController] |
| 129 | +[Route("api/[controller]")] |
| 130 | +public class DataController : ControllerBase |
| 131 | +{ |
| 132 | + [HttpGet("{value}")] |
| 133 | + public string Get(int value) => $"Value: {value}"; |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +Or with gRPC: |
| 138 | + |
| 139 | +```protobuf |
| 140 | +service DataService { |
| 141 | + rpc GetData (DataRequest) returns (DataReply); |
| 142 | +} |
| 143 | +``` |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +## Modular Design with .NET Core |
| 148 | + |
| 149 | +Instead of bundling everything, .NET Core uses **NuGet packages**: |
| 150 | + |
| 151 | +```bash |
| 152 | +dotnet add package Microsoft.EntityFrameworkCore.SqlServer |
| 153 | +dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer |
| 154 | +``` |
| 155 | + |
| 156 | +This modularity makes apps: |
| 157 | + |
| 158 | +* Smaller |
| 159 | +* More customizable |
| 160 | +* Easier to update independently |
| 161 | + |
| 162 | +--- |
| 163 | + |
| 164 | +## Summary |
| 165 | + |
| 166 | +| .NET Framework | .NET Core / .NET 5+ | |
| 167 | +| -------------------------------- | ---------------------------------------- | |
| 168 | +| Windows-only | Cross-platform | |
| 169 | +| Monolithic (everything built-in) | Modular (install only what you need) | |
| 170 | +| GAC, Web Forms, WCF, WF | NuGet, ASP.NET Core, gRPC | |
| 171 | +| Ideal for legacy enterprise | Ideal for modern web/cloud/microservices | |
| 172 | +| Slower evolution | Fast innovation & open-source | |
| 173 | + |
| 174 | + |
0 commit comments