AI Studio is a Visual Studio 2022 extension that adds AI-assisted code generation, refactoring, documentation, testing, and security analysis to the IDE directly from the context menu.
- Highlights
- Requirements
- Installation
- Quick Start
- Command Cheat Sheet
- Feature Walkthrough
- Configuration
- Advanced Customization
- Troubleshooting and Feedback
- License
- Seamless right-click workflow across C#, XAML, and most text-based files inside Visual Studio.
- Supports OpenAI, Anthropic (Claude), and Ollama (local or cloud) — switch provider from the Options page.
- Generates or updates code while preserving formatting, documentation, and project conventions.
- Built-in commands for documentation, explanations, security review, and unit test creation keep teams in flow.
- Integrated Output tool window now supports follow-up chat with a VS-themed input bar and smooth streaming updates without focus jumps.
- Visual Studio 2022 17.6 or later with the VSIX extension workload installed.
- An API key for your chosen provider (not required for local Ollama) with network access from the IDE.
- .NET Framework 4.8 SDK (installed with Visual Studio) for local builds.
- Open Visual Studio and choose
Extensions > Manage Extensions. - Search for AI Studio.
- Click Download and restart Visual Studio to complete the installation.
- Clone or fork this repository.
- Open
AI Studio.slnin Visual Studio 2022. - Build the solution in
Releasemode. - Double-click the generated
.vsixunderbin\Releaseto install it into your local instance.
- Choose a provider and obtain an API key if required (see the Provider Setup section below).
- Configure AI Studio via
Tools > Options > AI Studio > General: set the AI Provider, paste the key, and enter the model name. - Pick a feature (for example, Code It) by selecting code, right-clicking, and choosing the desired AI Studio command.
AI Studio supports three providers out of the box. Switch between them at any time under Tools > Options > AI Studio > General.
| Setting | Value |
|---|---|
| AI Provider | OpenAI |
| API Key | Your key from platform.openai.com/account/api-keys |
| Language Model | e.g. gpt-4o-mini, gpt-4o, o4-mini |
| API Endpoint | https://api.openai.com/v1/ (default) |
| Setting | Value |
|---|---|
| AI Provider | Anthropic |
| API Key | Your key from console.anthropic.com/settings/keys |
| Language Model | e.g. claude-sonnet-4-6, claude-opus-4-6, claude-haiku-4-5 |
| API Endpoint | (not used — hardcoded to https://api.anthropic.com/v1/messages) |
Ollama can run models locally on your machine or via the Ollama cloud.
| Setting | Value |
|---|---|
| AI Provider | Ollama |
| API Key | (leave empty) |
| Language Model | e.g. llama3.2, mistral, codestral |
| API Endpoint | http://localhost:11434 |
Pull a model first with ollama pull llama3.2, then start Ollama before using AI Studio commands.
| Setting | Value |
|---|---|
| AI Provider | Ollama |
| API Key | Your key from ollama.com (if required) |
| Language Model | e.g. mistral, llama3.2 |
| API Endpoint | https://ollama.com |
AI Studio uses Ollama's native
/api/chatendpoint. The endpoint field should be the base URL only — do not include/apior any path suffix.
Select OpenAI as the provider and change the API Endpoint to your private or self-hosted URL (e.g. https://llm.internal/api/v1). Enter the API key issued by that gateway and set the appropriate model name.
| Command | When to use | Output |
|---|---|---|
| Code It | Turn TODOs or signatures into working code. | Inserts generated implementation inline. |
| Add Comments | Document existing logic without manual XML comments. | Adds inline comments or summaries. |
| Add Summary | Produce XML doc comments for public APIs. | Generates <summary> and related tags. |
| Refactor | Improve readability or performance of selected code. | Replaces the selection with an optimized version. |
| Explain | Understand unfamiliar code quickly. | Displays a plain-language explanation. |
| Security Check | Inspect code for risky patterns and mitigations. | Lists potential vulnerabilities plus suggestions. |
| Add Unit Tests | Generate unit tests tailored to the selected method. | Creates a new test class or method snippet. |
- Place the caret on an empty method or select a stub.
- Right-click and choose
AI Studio > Code It. - Review the generated implementation and accept or adjust as needed.
- Highlight the code you want documented.
- Run
AI Studio > Add Comments. - AI Studio adds concise inline comments without disturbing formatting.
- Select a method or block.
- Choose
AI Studio > Refactor. - Compare the result with the original and apply the pieces you want to keep.
- Select a method header or type declaration.
- Run
AI Studio > Add Summary. - Automatically generates XML documentation that matches the signature.
- Highlight unfamiliar code.
- Choose
AI Studio > Explain. - A popup summarizes what the code does and why.
- Select code that handles I/O, crypto, or user data.
- Run
AI Studio > Security Check. - Review the flagged issues and suggested mitigations.
- Highlight a method to test.
- Run
AI Studio > Add Unit Tests. - AI Studio generates arrange/act/assert scaffolding tailored to the method.
Configure test generation under Tools > Options > AI Studio > Unit Test.
- Custom instructions let you specify frameworks (xUnit, NUnit, MSTest), naming rules, or mocking preferences.
- Response behavior controls how aggressively tests are regenerated versus appended.
All configuration lives under Tools > Options > AI Studio:
- General
- Paste your API key, pick the default model, and decide whether to format AI changes automatically.
- Toggle telemetry/diagnostics and adjust temperature or response size if needed.
- Commands
- Override the system prompt for each command, enforce coding guidelines, or switch to a custom model per command.
- Unit Test
- Choose the target test framework, namespace, class name template, and add reusable instructions for deterministic tests.
- Custom prompts per command: Tailor Refactor to focus on performance while Configure Comments to prioritize XML docs using
Tools > Options > AI Studio > Commands. - Bring your own endpoint: Point the extension at Azure OpenAI, a private/self-hosted LLM gateway, or any OpenAI-compatible proxy by entering the base URL and model ID in the General page.
- Formatting control: Enable Format changed text to run Visual Studio formatting on every AI edit to keep diffs clean.
- Response behavior: Decide whether AI should insert results inline, append to the Output window first, or prompt for confirmation.
- Verify your API key and quota if requests fail; the Output tool window surfaces errors returned by the provider.
- Ensure Visual Studio can reach the OpenAI endpoint (corporate proxies may need to allowlist it).
- Capture screenshots/logs and open an issue for bugs or ideas.
- Contributions are welcome via pull requests; please include before/after screenshots for UI tweaks.
AI Studio is released under the MIT License. Use it in personal or commercial projects with attribution.



