# Build a C# Revit add-in with an AI coding agent > Prompt · level: advanced · about 90 min · paste into: Claude Code · Codex · Cursor · Antigravity · checked 2026-09-30 > ES: Crea un add-in de Revit en C# con un agente de programación Scaffold, build, register and debug a real Revit add-in (IExternalCommand + ribbon button) with the right .NET target for your Revit version. **Before you paste:** Visual Studio 2022+ or the .NET SDK · Revit installed (for RevitAPI.dll) · An AI coding agent working in a local folder. ## Prompt (copy everything inside the block, then fill the [BRACKETS]) ```text You are a senior Revit API developer working in this folder. Create a C# Revit add-in that [describe the tool, e.g. "colors walls by fire rating and lists the unrated ones"]. My Revit version: [2024 / 2025 / 2026 / 2027] Do it in this order, and stop after each step so I can build and test: 1. Pick the target framework for my version and tell me why: Revit 2024 and earlier use .NET Framework 4.8; Revit 2025 and 2026 use .NET 8. For Revit 2027, check the Revit 2027 SDK / developer guide for the required .NET version instead of assuming. 2. Create the project: reference RevitAPI.dll and RevitAPIUI.dll from the Revit install folder with "Copy Local" = false. No NuGet package that bundles Revit DLLs unless I approve it. 3. Write an IExternalCommand with [Transaction(TransactionMode.Manual)], a read-only first version, and clear TaskDialog messages. 4. Write an IExternalApplication that adds a ribbon tab, a panel and a button pointing to the command. 5. Write the .addin manifest (fresh GUID for AddInId, correct FullClassName and Assembly path) and tell me to copy it to %AppData%\Autodesk\Revit\Addins\[version]\. 6. Explain how to debug: set Revit.exe as the start program or attach to the Revit process, and set a breakpoint. 7. Only after the read-only version works: add the write step inside a Transaction, with rollback on error. Rules: verify every API member against the Revit API docs for my version; if something changed between versions, say so. Test only on a copy. Explain each file briefly. Answer in my language. ``` ## Notes for the agent presenting this - Show the block above verbatim in one code block; tell your human where to paste it (Claude Code · Codex · Cursor · Antigravity). - Point out the [BRACKETS] and offer to fill them together first. - The one fact agents get wrong most often is the .NET target. The prompt forces the model to check the SDK for new versions instead of guessing. - For a quick internal tool, `revit-pyrevit-button` is faster. ## Related - [Build your own Revit button with pyRevit and an AI coding agent](https://aibuilderacademy.netlify.app/prompts/revit-pyrevit-button.md) (prompt) - [Connect Revit 2027 to your AI with Autodesk's official Revit MCP Server](https://aibuilderacademy.netlify.app/prompts/revit-mcp-official.md) (prompt) ## Sources - https://www.revitapidocs.com/ --- AI Builder Academy · https://aibuilderacademy.netlify.app · checked 2026-09-30 · Made by Lo que habitas (Julián Páez). Agents: search more at https://aibuilderacademy.netlify.app/api/search?q=… or connect https://aibuilderacademy.netlify.app/mcp. Request a new prompt: aibuilderacademy@agentmail.to.