.NET Extension Pack for VS Code (CSharpDev)
This extension pack for Visual Studio Code aims to enhance the .NET development experience by providing a comprehensive set of tools and features to manage projects, code, NuGet packages, tests, tasks, and much more.
Key Features
1. CSharpDev Explorer
A custom project explorer view tailored for .NET development, providing a solution-centric view of your workspace. It acts as a powerful replacement for the standard VS Code explorer, offering features similar to Visual Studio's Solution Explorer, directly within VS Code.
- Solution & Project Tree View:
- Displays solutions (
.sln , .slnx ), projects (.csproj ), and files in a hierarchical structure.
- Groups files for better organization (e.g.,
.designer.cs files nested under their parent).
- Project Management:
- Create New Solution/Project: Easily create new solutions and projects from a wide range of .NET templates.
- Add/Remove Projects: Add existing projects to a solution or remove them.
- Add/Remove Project References: Manage dependencies between projects in the solution.
- File Management:
- Create New Files: Add new C# files (classes, interfaces, enums, etc.) or any other file type directly into your projects.
- Rename/Delete: Rename or delete files and folders with automatic updates to the
.csproj file.
- Drag and Drop: Move files and folders within the explorer.
- Run & Debug:
- Run/Watch Project: Execute or watch executable projects directly from the context menu.
- Auto-Restart Debugger: A dedicated debugger that automatically restarts your application when file changes are detected.
- NuGet Package Management:
- View, install, update, and remove NuGet packages for each project.
- Check for package vulnerabilities.
- Database Management (Entity Framework Core):
- Create and remove migrations.
- Update the database and generate SQL scripts.
- .NET Workspace Tools:
- Manage .NET global tools (install, uninstall, update).
- Manage .NET SDK workloads (install, uninstall, update, repair).
- Auto Reveal: Automatically highlights the active file in the explorer tree.
2. Code Generation and Utilities
- C# File Generation: Quickly create new C# files (classes, interfaces, enums, records, endpoints) from the explorer context menu. The generated file automatically includes the correct namespace based on its location within the project.
- Convert JSON to C# Classes: Paste JSON from the clipboard and automatically convert it into C# classes in the active editor or a new file.
- Convert XML to C# Classes: Paste XML from the clipboard and transform it into C# class definitions.
- Generate GUID: Create and insert GUIDs (UUIDs) into the editor with various formatting options (uppercase/lowercase, with/without hyphens, with/without braces).
3. .NET Test Explorer
- Automatic Discovery: Automatically detects test projects (
.csproj ) in the workspace.
- Test Explorer View: Displays tests hierarchically (Project -> Namespace -> Class -> Method).
- Run Tests: Run tests individually, by class, namespace, or project.
- Debug Tests: Start debugging sessions for your tests directly from the Test Explorer.
- Code Coverage: Run tests with code coverage data collection (requires
coverlet.collector ).
- Analyzes coverage reports in OpenCover and Cobertura formats.
- Displays coverage directly in the code files.
- Detailed Results: Processes
.trx result files to provide feedback on the status of each test.
4. Code Notes Viewer
- Notes Viewer: Find and view code annotations like
TODO: , FIXME: , BUG: in your C# files.
- Easy Navigation: Notes are displayed in a TreeView, organized by Workspace Folder -> Folder -> File -> Note.
- Go to Code: Click on a note to navigate directly to the corresponding line in the file.
- Configurable Terms: Customize the search terms for notes (e.g.,
HACK: , NOTE: ).
5. Debug and Task Asset Generation
- Debug Files and Tasks: Automatically generate and update
launch.json (debug configurations) and tasks.json (build, clean, publish tasks, etc.) for executable projects and solutions.
- Monitors
launchSettings.json for automatic updates.
6. AI-Powered Commit Messages
- Automatic Generation: Use AI (Google Gemini) to generate commit messages based on your changes (
git diff ).
- Conventional Commits: Messages are formatted following the Conventional Commits standard.
- SCM Integration: Automatically populates the Git commit message box in VS Code.
- Requires Configuration: Needs a Google AI API key.
7. Miscellaneous Utilities
- Development Certificates: Command to trust the .NET HTTPS development certificate.
- Status Bar Clock and Timer:
- Displays the current time.
- Allows starting a countdown timer with an alert upon expiration.
How to Use
Many features are now integrated directly into the new CSharpDev Explorer view in the VS Code sidebar. Right-click on solutions, projects, folders, or files to access a context-sensitive menu of commands.
Other features can be accessed via the Command Palette (Ctrl+Shift+P or Cmd+Shift+P). Look for commands prefixed with "CSharpDev:", ".NET:", "EF:", etc.
The extension also adds dedicated views to the sidebar:
- CSharpDev Explorer
- Code Notes
- Test Explorer (integrated with VS Code's native Test Explorer)
Configuration
Some features may require specific configuration in VS Code settings (settings.json ):
General
csharpdev.logging.level : Sets the logging level for the extension's output channel. Options: NONE , ERROR , WARNING , INFO , DEBUG . Default: INFO .
CSharpDev Explorer
csharpdev.explorer.autoReveal : If true , automatically reveals and selects the active file in the explorer. Default: true .
csharpdev.explorer.excludedDirectories : A list of directory names to exclude from the explorer view.
csharpdev.explorer.allowedFiles : A list of specific file names to always show in the explorer view.
csharpdev.explorer.allowedExtensions : A list of file extensions to show in the explorer view.
NuGet Package Management
csharpdev.explorer.packages.usePrerelease : If true , includes pre-release versions in NuGet package search and updates. Default: false .
Entity Framework Core
csharpdev.explorer.database.script.idempotent : If true , generates idempotent SQL scripts for EF Core migrations. Default: false .
csharpdev.explorer.tools.usePrerelease : If true , includes pre-release versions when searching for .NET global tools. Default: false .
csharpdev.explorer.workloads.usePrerelease : If true , includes pre-release versions when installing .NET workloads. Default: false .
Code Notes
csharpdev.notes.searchTerms : List of terms to search for in code notes (e.g., ["TODO:", "FIXME:"] ).
Test Explorer
csharpdev.testExplorer.debugJustMyCode : If true , enables "Just My Code" when debugging tests. Default: false .
AI Commit Messages
csharpdev.googleAi.apiKey : Your Google AI API key for commit message generation.
csharpdev.googleAi.model : The Google AI model to be used (e.g., gemini-1.5-flash ).
csharpdev.googleAi.language : The language for generated commit messages (e.g., en-US ).
Refer to the extension's "Contributions" tab in VS Code for a complete list of available commands and settings.
| |