Tips and Tricks

How to Install and Use Claude Code or Codex in Visual Studio for C++

TL;DR
  1. Install Visual Assist 2026.5 or later, then turn on VA Intelligence in its options.
  2. Install the CLI for your agent from PowerShell (both commands are in Step 3).
  3. Open a new terminal, check that claude --version or codex --version works, then restart Visual Studio.
  4. Open Extensions → VAssistX → Tools → VA Agent and pick Claude Code or Codex.
  5. Send a message and sign in when the panel asks.

Steps tested with Visual Assist 2026.5 in Visual Studio 2026 and checked against Anthropic’s and OpenAI’s setup docs in November 2026. Not for VS Code.

Already have an existing Claude or ChatGPT account? If you use Visual Studio for C++, you don’t have to overhaul your existing setup to utilize those frontier models inside VS.

Claude Code and OpenAI Codex both offer CLI tools you can run on Windows, but getting them into Visual Studio isn’t quite as straightforward. Their official IDE integrations focus on other editors, leaving Visual Studio developers to switch between a terminal running the agent and the IDE containing their code.

There’s a more convenient way to work. With VA Agent, introduced in Visual Assist 2026.5, you can run Claude Code or Codex directly inside Visual Studio using the account you already have. No need to buy another AI plan or keep switching windows to work with your code.

This guide walks through setting up both agents on Windows, signing in with your existing account, and putting them to work inside Visual Studio. We’ll finish with a practical example using real C++ code.

What you need

For both agents:

  • Visual Studio 2015 or later
  • Visual Assist 2026.5 or later. The 30-day trial works too.
  • An open solution. VA Agent runs inside one

Then, depending on the agent you pick:

Claude Code Codex
Account A Claude Pro, Max, Ultra, Team or Enterprise plan, or an Anthropic Console account. A ChatGPT account. Our test ran on the Free plan; Plus, Pro, Business, Edu and Enterprise also include Codex
Windows Windows 10 (version 1809) or later Windows 11 recommended; Windows 10 (version 1809) or later
Install One PowerShell command One PowerShell command
Sign-in in VA Agent Sign in with your Claude account link Sign in with ChatGPT link

Step 1. Install or update Visual Assist

If you’re new to Visual Assist, start the 30-day free trial. If you already use it, update to 2026.5 or later.

Then turn on VA Intelligence, which VA Agent needs. Go to Extensions → VAssistX → Visual Assist Options → VA Intelligence, check Enable VA Intelligence, and click Save. You can skip the Download Ollama & Gemma 4 button, which is only for the optional local model covered at the end. If you forget this step, VA Agent offers to open the page the first time you send a message.

Visual Assist Options dialog open to the VA Intelligence page, with Enable VA Intelligence checked and a separate Download Ollama & Gemma 4 button.

Check Enable VA Intelligence once. The local model download is optional.

Step 2. Open VA Agent and pick your agent

Open a solution first, then go to Extensions → VAssistX → Tools → VA Agent.

Visual Studio's Extensions menu open to VAssistX, then Tools, with VA Agent highlighted.

Open VA Agent from Extensions → VAssistX → Tools.

The window docks with your other tool windows, so you can keep it beside your code. In the Agent dropdown, pick Claude Code or Codex. The third option, Gemma 4 (local), is the optional local model covered at the end.

VA Agent panel with the Agent dropdown open, showing Codex, Gemma 4 (local) and Claude Code.

Pick Claude Code or Codex in VA Agent’s Agent dropdown.

If you send a message before the CLI is installed, VA Agent tells you it can’t find it and directs you to finish the setup first. Proceed to Steps 3 and 4.

Two VA Agent panels side by side, labeled Claude Code and Codex, reading "The Claude Code CLI was not found on this computer" and "The Codex CLI was not found on this computer," each with links to set up the CLI or locate an existing install.

Before the CLI is installed, VA Agent tells you and links to the setup.

Step 3. Install the CLI

Claude Code and Codex are command-line tools (CLIs). VA Agent detects whichever one you’ve installed, or lets you choose between them if you have both. Install the CLI once from Windows PowerShell.

Side note: the Claude and ChatGPT desktop apps don’t count here. VA Agent looks for the CLI, so you need to install it even if you already have the desktop app. You can also run the CLI independently. Open a terminal in any project folder and enter claude or codex. It uses the same installation and account as VA Agent.

Claude Code

Run Anthropic’s installer. Running the command line instance as an administrator is not required.

irm https://claude.ai/install.ps1 | iex

The installer doesn’t show progress while it downloads, so give it a moment. If you’d rather use Command Prompt, Anthropic’s setup page has a CMD version of the command. There’s also a WinGet package (winget install Anthropic.ClaudeCode), though that one doesn’t update itself.

When it finishes, read the output. If there’s a Setup notes line saying .local\bin is not in your PATH, you’ll need the fix in Step 4.

Codex

Run OpenAI’s installer:

powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

The installer puts Codex in %LOCALAPPDATA%\Programs\OpenAI\Codex\bin and adds that folder to your user PATH. You don’t need an administrator terminal for this either. When the installer asks “Start Codex now? [y/N]”, press Enter to skip it. You’ll sign in from VA Agent in Step 5.

Two PowerShell windows labeled Claude Code and Codex. The Claude Code installer's setup note says its folder is not in PATH; the Codex installer reports "PATH updated for future PowerShell sessions."

Read the installer’s output. Claude Code may tell you to add its folder to your PATH; Codex adds itself.

Step 4. Check that Windows can find the CLI

Open a new PowerShell window and check that the CLI is available:

claude --version
codex --version

Run the one for the agent you’re installing. When properly installed, Claude Code prints a version number such as 2.1.295 (Claude Code). Codex prints its version too, such as codex-cli 0.167.2.

If PowerShell says the command is not recognized, the install folder isn’t on your PATH yet, which is the list of folders Windows searches when you type a command.

  • Claude Code: this happened on our test machine. The installer’s error prompt tells you how to fix it but doesn’t apply the fix for you, so here’s Anthropic’s documented fix, which adds %USERPROFILE%\.local\bin to your user PATH:
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')
  • Codex: the installer adds its folder to your user PATH, so a new terminal is usually enough. If it still isn’t found, check that %LOCALAPPDATA%\Programs\OpenAI\Codex\bin is in your user PATH.

Open another new terminal and check the version again.

Then restart Visual Studio. Visual Studio should pick up the refreshed PATH when it starts (an instance that was already open won’t see the new CLI). You can also use the VA Agent panel, which has a Locate claude on this computer… or Locate codex on this computer… link that lets you point it at the program yourself.

Step 5. Sign in

Back in VA Agent, send a message. The panel will ask you to sign in.

Claude Code

You’ll see “Claude Code is not signed in.” and a Sign in with your Claude account link.

Click the link to open Claude’s sign-in page in your browser. After signing in, Claude displays a code. Copy it, paste it back into the VA Agent panel, and you should see “Code accepted.” followed by the account you signed in with.

Three numbered steps for Claude Code: VA Agent says Claude Code is not signed in, the browser shows an authentication code to copy, and VA Agent shows "Signed in as …" with the email address blurred.

Sign in, copy the code, and paste it back into VA Agent.

Codex

You’ll see “Codex is not signed in” and a Sign in with ChatGPT link.

Click the link and sign in with your ChatGPT account in the browser. OpenAI’s sign-in hands the result back to Codex on your machine, so there’s no code to copy. When it’s done, the browser says “Signed in to Codex” and VA Agent shows “Signed in as” with your account and plan. You can also sign in from a terminal with codex login, or with codex login --device-auth if the browser hand-off is blocked on your network.

VA Agent with Codex before and after sign-in: "Codex is not signed in" with a Sign in with ChatGPT link, then "Signed in as … (free). Send your message again," with the email address hidden.

Codex signs in through your browser, with no code to copy.

Whichever agent you use, start a New chat once you’re signed in. The sign-in exchange stays in the first chat, and you probably don’t want your account details in a chat you might share or screenshot later.

Step 6. Choose a model and a mode

Pick a model and an effort level in the Model and Effort dropdowns. Available options depend on the agent and your plan, so your lists may look different from ours.

Then pick a Mode:

  • Ask Mode is for questions and planning.
  • Edits allowed lets the agent change files in your solution directly. You can undo its edits.

Ask Mode isn’t a sandbox, so keep your code in version control either way (as you would with any agent working on your code).

The agent choice is fixed after your first message in a chat. To switch between Claude Code and Codex, start a New chat.

VA Agent Mode dropdown open, with Ask Mode labeled "questions and planning" and Edits allowed labeled "agent edits your files."

Ask Mode for questions, Edits allowed when you want the agent to change files.

Try it on real code

We tried two tasks on a small sample solution. The screenshots show both Claude Code and Codex, but the steps are the same for either agent.

Ask about code before you change it. While using Ask Mode, we asked the agent to “Explain what NextPowerOfTwo in Core/MathUtil.cpp does”.

It opened the file itself and explained what the function does, with a table of example inputs and results. You can name a function, class or file in the same way, which makes it a quick way to get your bearings in code you didn’t write.

 VA Agent in Ask Mode with Claude Code explaining the NextPowerOfTwo function from MathUtil.cpp, including a table of example inputs and results.

Ask Mode: name a function and the agent reads the code and explains it.

VA Agent in Ask Mode with Codex explaining the NextPowerOfTwo function from MathUtil.cpp, with example inputs and results.

The same question, answered by Codex.

Make a targeted change and review it first. Select the code you want changed, press Shift + Alt + Q and choose Change Code with AI. A small panel opens under the selection with its own Agent picker. Describe the change and click Run. We selected FindAssetByName and asked the agent to use std::find_if and return nullptr.

The proposal shows up in VA Agent as a diff, and nothing changes in your file until you click Apply.

Lines 14 to 23 of AssetRegistry.cpp selected in the editor, with VA Agent's proposed diff overlaid: the for loop replaced by std::find_if, returning nullptr, with the Apply link highlighted.

Change Code with AI proposes a diff in VA Agent. Your file changes only when you click Apply.

Change Code works well for smaller changes that you want to review before applying. When you’re happy to let the agent edit files itself, switch to Edits allowed, and use undo if you don’t like the result.

Optional: run a local model instead

You can also run Gemma 4 locally if you prefer not to send code to an external AI provider, or don’t have a Claude or ChatGPT account. It’s separate from the setup above and entirely optional.

Go to Extensions → VAssistX → Visual Assist Options → VA Intelligence (the same page as Step 1) and click Download Ollama & Gemma 4. When the download finishes, pick Gemma 4 (local) in the Agent dropdown. There’s no CLI to install and no account to sign in to. It needs a GPU with at least 12 GB of video memory, and the download is about 9 GB.

Where your code goes depends on the agent. With Gemma 4, it stays on your machine. With Claude Code or Codex, it goes to Anthropic or OpenAI under your own account, just as it does when you run those tools in a terminal. Either way, nothing passes through Whole Tomato’s servers.

Troubleshooting

What you see What to do
claude is not recognized Add %USERPROFILE%\.local\bin to your user PATH (Step 4), then open a new terminal
codex is not recognized Open a new terminal. If it’s still missing, check that %LOCALAPPDATA%\Programs\OpenAI\Codex\bin is in your user PATH
irm is not recognized You’re in Command Prompt. Run the install command in PowerShell (for Claude Code, Anthropic also has a CMD version)
VA Agent says the CLI wasn’t found, but it runs in a terminal Restart Visual Studio, or use Locate claude on this computer… / Locate codex on this computer…
Claude Code sign-in timed out Click the sign-in link again, or run claude auth login
Codex sign-in doesn’t finish Run codex login, or codex login --device-auth if the browser hand-off is blocked
VA Agent asks you to upgrade Codex Newer Codex models need a recent CLI. Run the install command again.
The installer won’t run on an older Windows version Both CLIs need Windows 10 (1809) or later.
Your plan can’t use the agent Claude Code needs a paid Claude plan or a Console account. Codex needs a ChatGPT account (the Free plan worked in our test)
You can’t change the agent in a chat Start a New chat
VA Agent doesn’t run Open a solution first

For anything else, Anthropic’s installation troubleshooting page (including claude doctor, which has a health check of your install) and OpenAI’s Codex troubleshooting page should cover more cases.

The agent, next to your code

You can now use the same Claude Code or Codex CLI you’d run in a terminal, but from a docked window inside Visual Studio. It can read the files in your solution when you ask it something, and you can add or change code similarly as well. You can also switch anytime between Claude Code and Codex with a new chat.

VA Agent will keep changing, with new capabilities and refinements in upcoming releases. Tell us what it should do next on our Discord.

If you already use Visual Assist, update to 2026.5. If you’re new, you can try all of this free for 30 days.

FAQ

Is there a Claude Code or Codex extension for Visual Studio?

Neither has an official one. Anthropic’s IDE integrations are for VS Code and JetBrains IDEs, and OpenAI’s Codex integrations cover VS Code-based editors, Xcode and JetBrains. In Visual Studio, you can run either CLI in a terminal, or use VA Agent in Visual Assist to run it in a docked window.

Should I use Claude Code or Codex in VA Agent?

Use the one you already have a plan for. Both run in the same VA Agent window with the same modes, and you can switch between them by starting a new chat.

Does Visual Assist include a Claude or ChatGPT subscription?

No. Claude Code and Codex use your own account and plan. The optional local Gemma 4 model doesn’t need an account.

Does my code go through Whole Tomato’s servers?

No. Claude Code and Codex send your code to their own providers under your account. The local Gemma 4 model runs on your machine. Nothing passes through Whole Tomato’s servers.

Which Visual Studio and Windows versions does VA Agent support?

VA Agent supports Visual Studio 2015 and later, and in practice it needs Windows 10. The Claude Code and Codex CLIs need Windows 10 (version 1809) or later, and the local Gemma 4 model runs on Ollama, which needs Windows 10 (22H2) or later.

What’s the difference between Ask Mode and Edits allowed?

Ask Mode is for questions and planning. Edits allowed lets the agent change files in your solution directly, and you can undo its edits. Ask Mode isn’t a sandbox, so use version control either way.


 

Related posts
Tips and Tricks

Why You Should Turn On Code Inspections in Visual Assist

Build Announcements

Visual Assist 2026.5: Project-wide code inspections and new VA Agent window

Tips and Tricks

C++26 Memory Safety: What Actually Ships for Existing Code

Build Announcements

Visual Assist 2026.4 release post

Leave a Reply

%d