Skip to content

Add practical C# / .NET integration guide for the Copilot SDK#1

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/create-practical-documentation
Draft

Add practical C# / .NET integration guide for the Copilot SDK#1
Copilot wants to merge 2 commits intomainfrom
copilot/create-practical-documentation

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 7, 2026

No step-by-step guide existed for C# developers integrating the Copilot SDK from scratch in Visual Studio or VS Code.

New: docs/guides/dotnet-integration.md

A 17-section, end-to-end walkthrough covering everything from blank project to production-ready patterns:

  • Project setup — Visual Studio, VS Code + C# Dev Kit, and CLI flows
  • NuGet installation and .csproj verification
  • Minimal integration → multi-turn chat loop → streaming delta events
  • Custom tools via AIFunctionFactory.Create
  • File attachments, session hooks (pre/post-tool, prompt, lifecycle), infinite sessions + ResumeSessionAsync, and ask_user support
  • IDE tips for Visual Studio 2022, VS Code C# Dev Kit, and Rider
  • Common patterns: fire-and-collect, cancellation, parallel sessions
  • Auth options: signed-in CLI, env vars, GitHubToken, BYOK
  • Full worked example: streaming weather assistant with a custom tool
await using var client = new CopilotClient();
await using var session = await client.CreateSessionAsync(new SessionConfig
{
    Model = "gpt-4.1",
    Streaming = true,
    Tools =
    [
        AIFunctionFactory.Create(
            async ([Description("City name")] string city) =>
                await WeatherService.GetWeatherAsync(city),
            "get_weather",
            "Get current weather for a city")
    ],
    OnPermissionRequest = PermissionHandler.ApproveAll
});

Cross-references added

  • docs/guides/setup/index.md — new Decision Matrix row + paragraph
  • docs/getting-started.md — "Learn More" link
  • README.md — "Quick Links" entry

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Developer3421 <85111723+Developer3421@users.noreply.github.com>
Copilot AI changed the title [WIP] Create practical documentation for Copilot SDK integration Add practical C# / .NET integration guide for the Copilot SDK Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants