问题
I am using Visual Studio 2005 (VS.8.0) and I am looking to enforce the requirement that all class members, not just the public ones, be documented. While trivial to setup Visual Studio to generate warnings when public, protected, or internal protected members are not documented, I am looking for a way to have the private and internal members throw this same warning. Any suggestions?
NOTE: I am using warning level 4, am treating Warnings as Errors, and have the Generate XML flag set.
回答1:
Unfortunately, Visual Studio 2005 doesn't provide a way to enforce XML documentation on private or internal members and types.
I would recommend giving StyleCop a try, but it doesn't support Visual Studio 2005 (in fact, the latest version doesn't even support Visual Studio 2008 anymore, unfortunately). However, StyleCop can be setup to enforce documentation on all members.
But all is not lost as StyleCop is now open source, so you could obtain the source code and use it to inspire your own add-on for Visual Studio 2005 that mimics this particular operation.
来源:https://stackoverflow.com/questions/1172871/visual-studio-warn-on-missing-xml-documentation-for-private-and-internal-member