Installing CommentSense
CommentSense is distributed as a NuGet package that includes both analyzers and code fix providers. Choose your preferred installation method below.Using .NET CLI
Replace
* with a specific version number in the PackageReference example, or use Version="*" to always get the latest version.For Multiple Projects
If you have a solution with multiple projects, you can install CommentSense in all projects at once using Directory.Build.props:Enabling XML Documentation
CommentSense requires XML documentation generation to be enabled in your project. Without this, you’ll see the CSENSE000 warning.Enable for a Single Project
Edit your.csproj file and add the following property:
YourProject.csproj
Enable for All Projects
Add this to yourDirectory.Build.props file:
Directory.Build.props
Verifying Installation
After installation, verify that CommentSense is working correctly:Check for CSENSE000
If you haven’t enabled XML documentation yet, you should see a CSENSE000 warning indicating that documentation parsing is disabled.
Enable Documentation Generation
Add
<GenerateDocumentationFile>true</GenerateDocumentationFile> to your project.IDE Integration
CommentSense works seamlessly with popular C# development environments:Visual Studio
- Diagnostics appear in the Error List window
- Code fixes are available via the light bulb icon (Ctrl+.) or screwdriver icon
- Supports Fix All in Document, Project, or Solution scope
- Real-time analysis as you type
Visual Studio Code
When using the C# Dev Kit or C# extension:- Diagnostics appear as squiggles in the editor
- Code fixes available via Quick Fix (Ctrl+. or Cmd+.)
- Diagnostics shown in the Problems panel
JetBrains Rider
- Diagnostics appear in the Errors in Solution window
- Code fixes available via Alt+Enter
- Supports batch code fixes
CommentSense is a standard Roslyn analyzer and works with any IDE that supports .NET analyzers.
Troubleshooting
CommentSense Not Showing Diagnostics
Verify XML documentation is enabled
Verify XML documentation is enabled
Ensure
<GenerateDocumentationFile>true</GenerateDocumentationFile> is set in your .csproj file. If this is missing, you’ll only see CSENSE000.Check analyzer is installed
Check analyzer is installed
Run
dotnet list package to verify CommentSense appears in your package references.Clean and rebuild
Clean and rebuild
Sometimes the analyzer cache needs to be cleared:
Restart your IDE
Restart your IDE
If using Visual Studio or Rider, restart the IDE to ensure analyzers are reloaded.
Check visibility settings
Check visibility settings
By default, CommentSense analyzes
public and protected members. If you want to analyze internal or private members, configure comment_sense.visibility_level in .editorconfig.Build Performance Impact
CommentSense is designed to be performant, but if you experience build slowdowns:Uninstalling CommentSense
To remove CommentSense from your project:Next Steps
Quick Start
Get from installation to your first working example
Configuration
Customize CommentSense behavior via .editorconfig