Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do Visual Studio Intellisense comments come from?

Visual Studio projects have an option to create XML Documentation Files. I understand that XML Documentation Files can be useful if you'd like to run a program like Sandcastle or NDoc or whatever to create MSDN-Style API docs. Fine. I don't care about that.

According to this link: http://msdn.microsoft.com/en-us/library/s0we08bk.aspx

When you add the /doc switch to the Visual Basic, C#, or C++ compiler command line, an .xml file is generated that serves as the basis for IntelliSense documentation.

So that makes me think that Intellisense comments can appear from these generated XML files.

But I created a little Test app where I call a method in a totally different project and the XML comment appears in my Intellisense — And I haven't even saved the MediaHelper class! So in this case it's obvious there is no .xml file that Intellisense is using.

Comment from Un-Saved Class

In light of all this, where does Intellisense get it's junk from? Thanks!

like image 210
Chris Leyva Avatar asked Jan 25 '13 21:01

Chris Leyva


People also ask

What is IntelliSense How does it work?

IntelliSense is a code-completion aid that includes a number of features: List Members, Parameter Info, Quick Info, and Complete Word. These features help you to learn more about the code you're using, keep track of the parameters you're typing, and add calls to properties and methods with only a few keystrokes.

Does Visual Studio come with IntelliSense?

Visual Studio Code IntelliSense is provided for JavaScript, TypeScript, JSON, HTML, CSS, SCSS, and Less out of the box. VS Code supports word based completions for any programming language but can also be configured to have richer IntelliSense by installing a language extension.


1 Answers

When the source code is within the existing solution (or even better, the same project), Visual Studio doesn't need to find an XML file - it knows where the documentation comments are, so it will use them. (Just like Intellisense knows what members you've declared in the other file, even if you haven't actually rebuilt yet.)

You need to create an XML file if you want to add a reference to a DLL rather than a project reference within the same solution. So for example, I supply NodaTime.xml with the Noda Time package, so that even though you don't have the source code, you can still see the comments in Intellisense.

like image 85
Jon Skeet Avatar answered Nov 14 '22 04:11

Jon Skeet