Visual Studio 17中C#字符串语法与拼写检查扩展工具问询
Having to fix typos in legacy string literals is such a tedious task—here are the best Visual Studio 17 extensions I’ve used to automate this, with functionality similar to Grammarly but built for C# projects:
Visual Studio Spell Checker
This is my top pick for straightforward, no-fuss spelling checks. It scans every string literal in your project (along with comments and XML docs) and flags misspellings in real time. You can add custom dictionaries for project-specific jargon, exclude certain files or strings, and use quick fixes to correct typos instantly. Grab it from the VS Extensions Marketplace, then tweak settings underTools > Options > Spell Checkerto make sure it’s prioritizing string literals.ReSharper
If you’re already using JetBrains’ ReSharper, you don’t need a separate tool. Enable the "Spelling" inspection rule, and it’ll catch typos in string literals, plus offer context-aware suggestions. You can fine-tune which parts of your code are scanned and add custom dictionaries to avoid false positives for technical terms. It’s a bit heavier than the dedicated spell checker, but it integrates seamlessly with all your existing ReSharper workflows.Roslynator
For a flexible, Roslyn-powered solution, Roslynator includes analyzers that can target string literals. The core extension has basic spelling checks, and you can enable additional rules or even write simple custom analyzers if you need to enforce specific grammar patterns (like capitalization rules in user-facing strings). Install it via the Marketplace, then manage rules through theAnalyzerstab in Solution Explorer.StyleCop Analyzers
While StyleCop is mainly focused on code style, it has rules that check spelling in comments and string literals. Enable rules likeSA1649(which handles spelling in documentation but can be extended to strings) and adjust your rule set to focus on string-related checks. It works with Visual Studio’s built-in error list, so you’ll see warnings right alongside other code issues.
Quick Tips
- All these tools let you add custom dictionaries—use this to ignore project-specific acronyms, product names, or technical terms that aren’t in standard dictionaries.
- For large legacy projects, run a full solution scan first (look for the extension’s scan option in the Tools menu) to get a complete list of issues, then fix them in batches to save time.
内容的提问来源于stack exchange,提问作者kogop

