Common Extensions and Tools - Visual Studio
TLDR
- It is recommended to replace "extension bundles" with "individual installations" to avoid issues such as feature overlap, obsolescence, or incomplete uninstallation.
- For editor fonts,
Cascadia Monois recommended for a better reading experience on high-resolution displays. - For ASP.NET Core projects, it is recommended to use
Serilogfor structured logging, paired withSeqfor visual analysis. - For Dependency Injection (DI), it is recommended to use
Scrutorto supplement the lack of Assembly Scanning in the native DI container. YARPis the preferred choice for a reverse proxy due to its high integration with .NET and excellent performance.- When compressing files, if there are security requirements (to avoid residual temporary files), prioritize
System.IO.Compressionor native packages instead of calling an external7z.exe. - When using Excel packages in a commercial environment, be aware of the licensing restrictions of
EPPlus; switch toNPOIif necessary.
Visual Studio Extension Recommendations
When managing Visual Studio extensions, it is recommended to maintain an individual list rather than installing large bundles.
Why bundles are not recommended
When this issue occurs: When developers are accustomed to installing large bundles like "Productivity Power Tools" or "Web Essentials".
- Opaque Content: Installing a bundle often makes it unclear which specific tools are included, and the content frequently changes with versions.
- Feature Overlap and Obsolescence: As Visual Studio updates, many old features become unusable or are replaced by built-in VS functionality.
- Incomplete Uninstallation: Removing a bundle usually does not remove the sub-extensions that were installed, leaving behind tools that are no longer needed.
Recommended Extension List
- Productivity Power Tools related:
Double-Click Maximize 2022: Double-click to maximize the window.Fix Mixed Tabs: Detects and converts between Tabs and spaces.Middle Click Scroll: Use the mouse wheel to scroll through documents.Solution Error Visualizer: Displays error hints in the Solution Explorer.
- Dev Essentials related:
File Icons: Beautifies file icons.SVG Viewer: SVG preview and optimization.Editor Enhancements: Enhances code sorting, text encoding, and other features.Markdown Editor v2: Built-in Markdown support for the editor.Image Optimizer: Image compression.
- Other Useful Tools:
ResXManager: Essential for multi-language development, provides Excel-like table management for.resxfiles.Editor Guidelines: Provides code length guide lines (recommended settings: 80, 100, 120 characters).VSColorOutput: Adds color-coding to Build messages in the Output window.
Visual Studio Environment Optimization
Font and Display Settings
When this issue occurs: On high-resolution screens, older fonts (like Consolas) may provide a poor reading experience, or the mouse pointer may behave erratically.
- Font Selection:
Cascadia Monois recommended. It is designed specifically for code, and the reading experience is superior to Consolas. - Cascadia Code vs. Mono: It is recommended to choose
Cascadia Mono. SinceCascadia Codesupports ligatures (e.g.,!=becomes≠), it can easily cause confusion in symbol interpretation; choosing the Mono version without ligatures is safer. - Screen Display: If the mouse pointer behaves abnormally when operating on SQL files, try disabling "Optimize rendering for screens with different pixel densities".
Editor and Language Settings
- Document Tabs: It is recommended to set the position to "Left" or "Right" to increase vertical reading space, and enable "Tab Coloring" to distinguish between projects.
- C# Advanced Settings:
- Enable "Show procedure line separators": Adds white lines between methods and properties.
- Enable "Fade" settings: Alerts you to redundant Usings and variables.
- Enable "Underline reassigned variables": Makes it easier to track variable states.
NuGet Package Selection and Recommendations
Structured Logging
When this issue occurs: When traditional NLog is used to record plain text, making it impossible to effectively search and analyze log data.
- Recommended Practice: Use
Serilog.AspNetCore. - Core Concept: Serilog records "Data" rather than "Text". For example,
Log.Info("User {Id}", id), Serilog treatsIdas a searchable field. - Visualization Recommendation: Pair with
Serilog.Sinks.Seqto visualize structured logs; debugging efficiency is far superior to text files.
Dependency Injection (DI)
When this issue occurs: When using the .NET native DI container and finding a lack of advanced features like Assembly Scanning.
- Recommended Practice: Install
Scrutor. It fills the gap where native DI features are relatively basic, enabling concise automatic registration.
Reverse Proxy
When this issue occurs: When a high-performance gateway needs to be selected in a microservices architecture.
- Recommended Practice: Use
YARP. Compared toOcelot, YARP is highly integrated with .NET, actively maintained, and performs better in core forwarding and load balancing.
Compression and File Handling
When this issue occurs: When a project has data encryption or "no-disk-storage" security requirements and requires file compression.
- Recommended Practice: Avoid calling external
7z.exe; useSystem.IO.CompressionorDotNetZipinstead. - Reasoning: Calling external executables usually involves writing data to temporary files. If processing fails and files are not deleted, it may lead to sensitive data leaks. Native packages process data in memory, which is relatively safer.
Excel Processing
- Licensing Reminder:
EPPlus5 and later have switched to a non-commercial license. For commercial environments, it is recommended to switch toNPOI.
Change Log
- 2022-11-10 Initial document creation.
- 2025-04-06
- Added instructions for "Automatically update extensions" settings.
- Removed "Code Cleanup on Save" as it has been built into Visual Studio 2022 for a long time and does not need to be listed separately.
- Updated descriptions for some packages.
- 2025-12-31
- Removed obsolete packages and those requiring commercial licenses.
- Updated Visual Studio setting recommendations, recommending the Cascadia font family.
- Added packages such as YARP, Scrutor, and MQTTnet.
