.NET Battery Pack VS Code Extension
.NET Battery Pack closes gaps between popular .NET extensions, upgrading your Resharper, C# Dev Kit, and DotRush experience for Visual Studio Code. It brings advanced semantic snippets, surround-with refactorings, and NuGet package management to your workflow.
Features
Commands
.NET Battery Pack: Reload Workspace
Reloads the workspace for semantic snippet updates.
.NET Battery Pack: Show Surround Options
Opens a menu to select a surround-with snippet.
.NET Battery Pack: Apply Surround Snippet
Applies a selected surround-with snippet to the current selection.
NuGet: Add Package
Search for and add a NuGet package to selected projects/solutions.
NuGet: Update Package
Update a NuGet package to a selected version in your projects/solutions.
NuGet: Remove Package
Remove a NuGet package from selected projects/solutions.
NuGet: Toggle Prerelease Packages
Toggle whether prerelease NuGet packages are included in search results.
Find Type on NuGet.org (Context Menu)
Available as a context menu option when CS0246 "The type or namespace could not be found" errors occur, or when ReSharper reports "Cannot resolve symbol". Searches for NuGet packages containing the specified type and allows installation of the selected package.
All commands are available from the Command Palette.
Example Usage
Surround With Example:
Select code and choose "Surround With" → "if statement":
Console.WriteLine("Hello");
becomes
if (true)
{
Console.WriteLine("Hello");
}
NuGet Add Example:
- Run
NuGet: Add Package
- Search for
Newtonsoft.Json
- Select version
- Package is added to your project or solution
Reverse NuGet Search Example:
When you have a CS0246 error for an unknown type like ILogger :
- Right-click on the error or use the lightbulb quick fix
- Select "Find 'ILogger' on NuGet.org"
- Choose from the top 10 matching packages (e.g., Microsoft.Extensions.Logging.Abstractions)
- Package is automatically installed to your project
Configuration
dotnetBatteryPack.semanticSnippets.enabled
Enable semantic snippets for C# files (default: true )
dotnetBatteryPack.semanticSnippets.disableWhenExtensions
List of extension IDs that, if enabled, will disable semantic snippets (default: ["nromanov.dotrush", "JetBrains.resharper-code"] )
dotnetBatteryPack.surroundWith.enabled
Enable surround with code actions for C# files (default: true )
dotnetBatteryPack.surroundWith.disableWhenExtensions
List of extension IDs that, if enabled, will disable surround with features (default: ["ms-dotnettools.csharp", "ms-dotnettools.csdevkit"] )
dotnetBatteryPack.nugetCommands.enabled
Enable NuGet commands (add, update, remove) for .NET projects (default: true )
dotnetBatteryPack.nugetCommands.includePrerelease
Include prerelease NuGet packages in search results (default: false )
Getting Started
- Install the extension from the VS Code Marketplace
- Ensure the DotRush extension is installed (but not enabled) for semantic snippet support
- Use the provided commands from the Command Palette or context menus
Release Notes
See CHANGELOG.md for details.
| |