Skip to main content

Command Palette

Search for a command to run...

C#

This guide will help you configure Cursor for C# development, including setting up the .NET SDK, installing extensions like ReSharper or DotRush, debugging, running applications, and working with frameworks like ASP.NET Core and Blazor.

Setting up C# for Cursor

.NET SDK Installation

Before setting up Cursor itself, you need the .NET SDK installed on your machine.

  • Windows: Download and install from dotnet.microsoft.com. The installer configures PATH automatically.
  • macOS: Install via Homebrew (brew install dotnet) or download the installer from the official site.
  • Linux: Use your package manager or follow the official installation guide.

To check installation, run:

dotnet --version
{  "omnisharp.dotNetCliPaths": ["/path/to/.dotnet"],  "dotnet.dotnetPath": "/path/to/.dotnet/dotnet"}

Cursor Setup

ReSharper for Cursor

ReSharper for Cursor is a professional productivity toolkit for .NET developers. It enables you to keep your code clean, navigate your projects with ease, and refactor with confidence.

Key features include:

  • Solution Explorer: Manage all files, folders, NuGet packages, source generators, and projects in a single place.
  • Code analysis: Identify and fix code issues on the fly with real-time recommendations in C#, Razor, Blazor, and XAML.
  • Unit testing: Run and manage C# unit tests with built-in support for NUnit, xUnit.net, and MSTest.
  • Code refactorings: Safely restructure code and improve maintainability using tools like Rename, Extract Method, and Introduce Variable.
  • Navigation and search: Stay oriented and productive, even when you're working on a complex solution or reviewing unfamiliar code.

ReSharper is free for non-commercial use and offers a 30-day trial for commercial projects.

DotRush for Cursor

DotRush is a free, open-source C# extension maintained by the community under the MIT license. It's a lightweight option for developers who want C# language support in Cursor without a commercial license.

Key features include:

  • C# IntelliSense: Roslyn-based autocompletion, suggestions, and code navigation.
  • Debugging: Built-in .NET Core debugger for stepping through your code.
  • Unit testing: Run and debug your C# tests from the editor.
  • Multi-platform support: Works on Windows, macOS, and Linux.

DotRush focuses on core C# language features and doesn't support Razor, XAML, or Blazor. If you work with those, choose ReSharper instead.

Running and Debugging

Now you're set up, it's time to run and debug your C# code.

Run

Click "Run" above any Main method, or use dotnet run in the terminal

Debug

Open the Run and Debug sidebar panel and select ".NET Core Launch" to debug your application

Terminal

Execute from command line using dotnet run, dotnet test, or dotnet build

Hot Reload

Use dotnet watch for automatic recompilation when files change

Configure launch.json

For custom debug configurations, create a .vscode/launch.json file:

{  "version": "0.2.0",  "configurations": [    {      "name": ".NET Core Launch (web)",      "type": "coreclr",      "request": "launch",      "preLaunchTask": "build",      "program": "${workspaceFolder}/bin/Debug/net8.0/MyApp.dll",      "args": [],      "cwd": "${workspaceFolder}",      "stopAtEntry": false,      "env": {        "ASPNETCORE_ENVIRONMENT": "Development"      }    }  ]}

Framework Support

Cursor works with all major .NET frameworks:

ASP.NET Core

  • Full support for Controllers, Minimal APIs, and Razor Pages
  • Route and middleware intelligence
  • Configuration and dependency injection assistance

Blazor

  • Component syntax highlighting and completions
  • Razor syntax support for both Server and WebAssembly modes
  • CSS isolation and interop assistance

.NET MAUI

  • Cross-platform mobile and desktop development
  • XAML support with design-time data
  • Platform-specific code assistance

Entity Framework Core

  • DbContext and migration scaffolding
  • LINQ query generation and optimization
  • Connection string and configuration help

Modernizing legacy .NET code

Teams use Cursor to take on .NET refactors that would otherwise stay on the backlog. National Australia Bank rebuilt BizCalc, a Silverlight/.NET fee calculator for its business lending unit, as Java microservices with a React front end. NAB's pre-development work (documenting how the legacy code behaves, writing user stories, and producing an API spec) was scoped at two months and finished in a week using Ask Mode and Plan Mode. The team now expects the full migration to land in two months instead of six.

For prompts and rules files you can adapt to your own .NET migration, see Modernizing Legacy Code with Cursor. The full story is in the NAB case study.