.NET Framework/Core vs .NET Standard Class Library
π‘ Concept Name
.NET Framework/Core vs .NET Standard Class Library
π Quick Intro
.NET supports multiple project types like .NET Framework, .NET Core, and .NET Standard. Each serves a specific runtime or compatibility goal. Choosing the right one is essential for app portability and reuse.
π§ Analogy / Short Story
Imagine you're writing a book. A .NET Framework project is a book written for readers in one country. A .NET Core project is the same book written for a different country. A .NET Standard library is like writing the story in a universal language everyone understands. That way, all countries can read and use it.
π§ Technical Explanation
.NET Framework Class Library: Targets Windows-only legacy systems. Compatible only with the full .NET Framework.
.NET Core Class Library: Targets cross-platform .NET Core apps. Not compatible with older .NET Framework apps.
.NET Standard Class Library: A unifying contract. Can be referenced by both .NET Core and .NET Framework (based on version). Encouraged for reusable libraries.
π― Purpose & Use Case
- β Use .NET Framework class libraries when working in full Windows desktop/server environments.
- β Use .NET Core class libraries for modern, cross-platform applications.
- β Use .NET Standard when you want to share libraries between .NET Core, .NET Framework, Xamarin, etc.
π» Real Code Example
Example: Using .NET Standard Class Library from both Core and Framework projects
// .NET Standard Class Library
public class Calculator {
public int Add(int a, int b) => a + b;
}
// This library can be used in both .NET Core and .NET Framework projects

β Interview Q&A
Q1: What is .NET Standard?
A: A specification of APIs available across all .NET implementations.
Q2: Can a .NET Core app use a .NET Standard library?
A: Yes, if it supports the targeted .NET Standard version.
Q3: Can a .NET Framework app use a .NET Core library?
A: No, .NET Core libraries arenβt backward compatible.
Q4: Which project type is most portable?
A: .NET Standard Class Library.
Q5: Is .NET Standard still recommended with .NET 6+?
A: No, .NET 6+ prefers targeting net6.0 directly since unification.
Q6: Which project type should you use for legacy apps?
A: .NET Framework Class Library.
Q7: Can .NET Standard contain platform-specific APIs?
A: No, it contains only common APIs.
Q8: What is the main reason to use .NET Standard?
A: To build reusable libraries across different .NET runtimes.
Q9: Is .NET Core faster than .NET Framework?
A: Generally yes, especially for web workloads.
Q10: What replaced .NET Standard in .NET 5+?
A: .NET 5+ uses target frameworks like net5.0, net6.0 etc., removing the need for .NET Standard.
π MCQs
Q1. Which .NET project type is best for cross-platform reuse?
- .NET Framework
- .NET Core
- .NET Standard
- UWP
Q2. What does a .NET Standard class library target?
- Only Windows APIs
- Only ASP.NET APIs
- Common API set shared by all .NET platforms
- Xamarin-specific code
Q3. Can .NET Framework use a .NET Standard library?
- Yes
- No
- Only with wrappers
- Only in .NET 8+
Q4. Which library is NOT cross-platform?
- .NET Core Class Library
- .NET Framework Class Library
- .NET Standard
- net6.0 project
Q5. What does .NET Standard help avoid?
- Compilation errors
- Memory leaks
- Rewriting libraries for each platform
- Null reference exceptions
Q6. Which project type is best for Windows-only desktop apps?
- .NET Core
- .NET Standard
- .NET Framework
- Mono
Q7. What is the trend in .NET 6+ for libraries?
- Using .NET Standard
- Using PCLs
- Targeting net6.0 or later
- Targeting Xamarin.Forms
Q8. Is .NET Standard a runtime?
- Yes
- No, it’s a runtime
- No, it’s a specification
- Only for libraries
Q9. Which project type can be used in both .NET Core and Framework apps?
- .NET Core
- .NET Framework
- .NET Standard
- .NET MAUI
Q10. Is .NET Core backward compatible with .NET Framework?
- Yes
- No
- Only for DLLs
- Depends on the API
π‘ Bonus Insight
While .NET Standard once played a major role in library compatibility, modern .NET versions (5, 6, 7+) unify runtimes under one SDK β reducing the need for .NET Standard in new projects.
π PDF Download
Need a handy summary for your notes? Download this topic as a PDF!