The Deska blog
Running Agents on a .NET Codebase
Learn how to optimize running agents on a .NET codebase using modern CLI tools, effective project structures, and the Deska local-first workspace.
10 min read
Developing software within the Microsoft ecosystem has evolved rapidly with the introduction of autonomous entities capable of writing and refactoring code. Successfully running agents on a .NET codebase requires more than just a chat interface. It demands a deep integration with the MSBuild system, an understanding of NuGet dependency trees, and a workspace that can handle the high telemetry and file output these agents generate. This guide explores how to configure your environment for C# and .NET projects when using modern agentic workflows.
The Architecture of .NET Focused Agents
When we talk about running agents on a .NET codebase, we refer to specialized AI models that operate through a Command Line Interface (CLI) or a dedicated workspace. Unlike simple completion tools, these agents can execute dotnet build commands, analyze compiler errors, and iterate on fixes until the code passes validation.
The primary challenge for an agent in a .NET environment is the sheer volume of metadata. Between .csproj files, bin and obj folders, and the Global Assembly Cache, an agent can easily get lost in the noise. Effective agents need to be directed to focus on the source files while respecting the structure of the Solution (.sln) file.
Common Agentic Workflows
Most developers currently utilize a handful of established tools for this purpose. Each has a different approach to interacting with the file system and the compiler.
- Claude Code: A research preview tool that runs in the terminal. It excels at complex reasoning and can execute shell commands to verify .NET builds.
- Codex CLI: Focused on quick transformations and script generation.
- OpenCode: An open source alternative that provides a framework for multi-agent collaboration.
These tools are often run side by side to compare outputs. For instance, you might have one agent focused on writing unit tests in xUnit while another refactors a service layer.
Setting Up the Workspace for .NET
A standard IDE is often too cluttered for agentic work. When an agent starts modifying dozens of files, you need a way to visualize the changes without losing context. This is where a specialized canvas approach becomes valuable.
Deska provides an infinite canvas where you can place terminals and code editor panels anywhere. For a .NET developer, this means you can have a terminal running a watch command (dotnet watch test) in one corner while an agent works in another.
Managing Project Context
To keep an agent efficient, you must manage its context window. In .NET projects, this involves:
- Excluding the
artifacts,bin, andobjdirectories from the agent's search path. - Providing the agent with the relevant
.csprojfile so it understands the target framework and dependencies. - Using a local-first approach to ensure that the agent has low-latency access to the entire repository.
By keeping your files and sessions local, you avoid the security concerns of uploading proprietary business logic to a third party cloud IDE. Deska follows this philosophy, keeping all files and sessions on your machine.
Tool Comparison for C# Developers
Choosing the right tool depends on your specific needs for the project. Some tools are better for greenfield development, while others excel at maintaining legacy systems.
| Feature | Claude Code | OpenCode | Deska Workspace |
|---|---|---|---|
| Interaction | CLI only | CLI or API | Visual Canvas |
| .NET Integration | Via Shell | Via Shell | Integrated Terminals |
| Privacy | Cloud API | Local or Cloud | Local-first storage |
| Multitasking | Single Stream | Multiple Agents | Side by side panels |
While Claude Code and OpenCode provide the "brain" for the operation, the workspace provides the "body." Using these agents within a unified environment allows you to see the browser for documentation, the terminal for logs, and the code editor simultaneously.
Voice and Automation in .NET Workflows
One of the more advanced ways of running agents on a .NET codebase is through voice commands. This is particularly useful for repetitive tasks like generating boilerplate for Dependency Injection or creating Data Transfer Objects (DTOs).
With Ask Deska, you can use voice to drive your workspace. You might say "Open the terminal and run the latest migration" or "Ask Claude to refactor the controller in the panels below." This creates a hands-free bridge between your intent and the execution of the CLI agents.
Handling Mobile and Remote Access
Software development does not always happen at a desk. Sometimes a long-running build or a complex agentic refactoring session needs to be monitored while away from the workstation.
The Deska mobile app allows you to monitor these sessions through a secure relay. Because the devices pair directly without exposing ports, you can check the progress of your .NET agents from your phone. This is crucial for long-running tasks where an agent might be performing a comprehensive sweep of a large solution to update NuGet packages or fix breaking changes after a framework upgrade.
FAQ for .NET Agents
How do I stop agents from reading bin and obj folders?
Most agents respect a .gitignore file or a specific ignore configuration. Ensure your .NET project has a standard gitignore that excludes build artifacts. In a visual workspace, you can also limit the agent's scope by only opening specific panels for the directories relevant to the current task.
Can I run multiple agents on the same .NET project?
Yes, it is common to run different agents side by side. You might use one panel for Claude Code to handle logic and another for a different CLI tool to handle documentation or CSS within a Blazor project. Managing these agent threads in a single view prevents context switching.
Is my C# code secure when using these agents?
Security depends on the inference model and the workspace. Using a local-first tool ensures your files stay on your hardware. If you are using your own API keys, your code is sent to the provider for processing but is generally not stored for training, depending on your agreement with the provider.
Getting Started with Deska
If you are ready to optimize how you are running agents on a .NET codebase, you can start by setting up a clean workspace. Transitioning from a traditional linear editor to an infinite canvas allows you to visualize the complex relationships in your C# projects more clearly.
You can download the free desktop app for Mac, Windows, or Linux to begin building your custom .NET agent environment today. Explore the getting started guide to learn how to connect your first CLI agent and configure your terminals for the .NET CLI.