NEWAI for Developers - skills, agents and practical lessonsExplore

Free guide for C# developers

AI for .NET Developers

How to build AI features in C# and use AI coding tools on a .NET codebase.

This page groups every AI tutorial on TheCodeMan by topic. Start with a model call through Microsoft.Extensions.AI, then add agents, MCP tools and search over your own data. The last section covers Claude Code and GitHub Copilot on .NET projects.

Updated November 2026 for .NET 11.

The .NET AI stack

Six layers, and which one you need first.

Most AI work in .NET uses the same few building blocks. You rarely need all of them at once. A chat feature needs only the first one.

MODEL ACCESS

Microsoft.Extensions.AI

IChatClient and IEmbeddingGenerator are the common interfaces for chat and embedding models. You can switch from OpenAI to Ollama without rewriting your code, and add caching, logging and OpenTelemetry as middleware.

IChatClient

AGENTS

Microsoft Agent Framework

Agents that call your tools, keep conversation state and run multi-step workflows. Version 1.0 shipped in April 2026 and replaces Semantic Kernel for new projects.

Microsoft.Agents.AI

TOOLS

Model Context Protocol (MCP)

Expose your own C# methods as tools that Claude, GitHub Copilot or your own agent can call. The official MCP C# SDK builds on ASP.NET Core, and the .NET 11 SDK ships an MCP server template.

dotnet new mcpserver

YOUR DATA

Embeddings, vector search and RAG

Turn text into vectors with IEmbeddingGenerator, search them with EF Core on SQL Server 2025 or with PostgreSQL pgvector, then pass the best matches to the model.

IEmbeddingGenerator

UI

Blazor AI components

Components for streaming chat, tool results and approval steps. They are experimental and ship as a prerelease package during .NET 11.

Microsoft.AspNetCore.Components.AI

CODING WITH AI

Claude Code, GitHub Copilot, .NET Skills

Coding agents do better on a .NET repository when they get project context, .NET skills (SKILL.md files) and a C# language server. You still review the diff and run the tests.

SKILL.md

01 / START HERE

Your first AI feature in C#

One abstraction, IChatClient from Microsoft.Extensions.AI, covers OpenAI, Azure OpenAI, Ollama and other providers. Learn model calls, streaming and DI before adding anything else.

02 / AGENTS

AI agents in C#

An agent is a model that can call your tools over several steps. Microsoft Agent Framework is the .NET library for this and replaces Semantic Kernel for new projects.

03 / MCP

MCP: connect AI to your .NET code

The Model Context Protocol lets Claude, Copilot and your own agents call tools you write in C#. The official MCP C# SDK builds on ASP.NET Core.

04 / YOUR DATA

Embeddings, vector search and RAG

Retrieval comes before generation. Turn text into embeddings, search them in SQL Server or PostgreSQL, then pass the best matches to the model.

05 / CODE WITH AI

AI coding tools for .NET developers

Claude Code and GitHub Copilot work better on a .NET repository when they get project context, skills and checks. Review every change and run your tests.

Want a structured plan?

Follow the AI roadmap for .NET developers, or try the free course preview.

Go further

Skills, agents and lessons in the AI for Developers community.

The tutorials on this page are free. The community adds the toolkit I use on real projects, step-by-step lessons and a place to ask questions while you build.

  • Claude Code skills and agents, including a .NET pack
  • Lessons on AI coding workflows and AI features
  • Discussions with other developers using the same tools
7-day free trial

See what is inside before you pay.

See the community

FAQ

Questions .NET developers ask about AI

Can I build AI applications in C# without Python?

Yes. Microsoft.Extensions.AI gives C# a common interface for chat and embedding models, with providers for OpenAI, Azure OpenAI, Ollama and others. Microsoft Agent Framework adds agents and workflows, and the official MCP C# SDK covers MCP servers and clients. Python is not required for any of these.

Where should a .NET developer start with AI?

Build one small feature with IChatClient: a model call, streaming and dependency injection. Then add tool calling, then retrieval over your own data. Agents and MCP are easier to understand after that. For AI coding tools, start with one task on a repository you know well and review the diff.

Should I use Semantic Kernel or Microsoft Agent Framework?

For new projects, Microsoft Agent Framework. It reached version 1.0 in April 2026 and brings together ideas from Semantic Kernel and AutoGen. Existing Semantic Kernel projects keep working, and Microsoft provides a migration guide.

What is the difference between MCP, RAG and an AI agent?

MCP is a protocol for connecting AI clients to tools and data. RAG retrieves relevant text and adds it to the model input. An agent is a model that can call tools across several steps to finish a task. You can use each one on its own.

Do I need a vector database for RAG in .NET?

Not always. EF Core 10 can run vector search on SQL Server 2025 and Azure SQL, and PostgreSQL has the pgvector extension. A dedicated vector database makes sense when your data or search needs outgrow those. Test with your own data before you decide.

Which AI coding tool is best for .NET?

Claude Code and GitHub Copilot both work well with C#. In practice the result depends more on the setup than on the tool: project instructions, .NET skills, a C# language server and a test suite the agent can run.

How should I handle private code and AI-generated changes?

Use the AI tools your organization approves and check their data settings before sharing source code. Keep credentials out of prompts, limit tool permissions, review diffs and run your tests. Treat AI output as a draft for engineering review.