I am developing a .Net library (dll). All the public methods are decorated with full /// comments.
When I hover over one of these methods whilst in the same solution (eg in a test project) I can see the comments as a tooltip.
However when I reference the dll in a different Visual Studio solution, I can't see the comments in the intellisense tooltip.
Is there something I need to do to 'turn this on'? I notice I can see comments when I hover over .Net library methods, for example.
In the project properties, you need to enable the setting "XML documentation file" under the Build tab - and then keep the generated Xml file in the same folder as your Dll.
You need to make sure 'Generate XML documentation file' is enabled in your project settings.
(Compile tab on VB, not sure exactly where it is in C#).
Related
Using Visual Studio 2013 and .NET I've created set of widgets which I want to use in external projects. Each class and method is well documented with the XML-style comments. For example:
///<summary>...</summary>
When I use already commented code within the same solution, the appearing prompt suggesting how to finish the line contains my remarks. Nevertheless, when I tried to generate a DLL file with the code and use it in the external project the comments were not available anymore. How can I document code to make these hints visible in other projects using the compiled DLL?
If you want to use Code Documentation when referencing dll you have to generate XML documentation. XML documentation has to be in same folder that .dll is in.
I have been working with a DLL which contains some classes, and one of the classes has some constants. I wrote Summary for every one of these constants and these summaries appears as "tooltips" when I want to use the constants inside the DLL.
However, when I access these constants from the main project which is referencing this DLL, I don't see any Summary in the tooltip.
Does anyone know a solution for this problem? Everything is declared with a public access modifier. But MVS2013 does not cache these Summaries.
To see the summaries outside of the project you need to build the XML documentation file. Go to the project settings and select the Build section. At the bottom you'll see the "Output" options, and there will be a checkbox for XML documentation file make sure it's checked (in both debug and release modes).
If you're deploying the assembly by hand to other projects you'll need to make sure you copy the documentation XML file as well.
I'm looking for a way to find the methods in a large solution that do not have XML documentation. Without trawling class by class, project by project through the solution, is there a simple way?
(Ideally I'd like to be able to double-click to navigate straight to the offending method)
There's a built-in way in Visual Studio. In your project Properties -> Build page, tick the XML documentation file box, and rebuild. All methods without XML documentation generate a warning.
Me: I'm a relative new-comer to the .NET platform.
Problem
In Java, you can add package level documentation to your project by creating a package-info.java or package.html file and storing in the package folder. How do I add equivalent documentation to my project in C# using Visual Studio 2010?
Background
I like to write documentation describing my motivations in the package/folder level context of the source code projects that I am working on. I have become very accustomed to this workflow in a variety of languages (specifically Java) and I believe that it is a good way to document my project.
C# will automatically turn the XML-based tripple-slash comments into intellisense documentation.
///<summary>This method does something!</summary>
///<parameter name="p1">The first parameter</parameter>
///<return>true, if the method completed successfully</return>
public bool DoSomething(int p1){
return p1 > 0;
}
When you compile your project into a class library and reference it in another project, the above will automatically be turned into a useful tooltip. In addition, the C# compiler can optionally produce an XML file with all of these comments alongside your DLL. This XML file can be fed into Sandcastle (as mentioned previously) and added to a documentation project as MSDN-style API reference.
The Sandcastle tool has its own project and documentation structure, so you'll want to start up a side project if you're going to add anything more than the XML-generated Intellisense reference.
The focus is a bit different in .NET, it has very good support for generating IntelliSense info. Documentation at your finger tips. I'm sure you're familiar with it when you used VS for a while, look up "xml documentation".
Off-line docs used to be covered by NDoc but the guy that supported it quit his project. The Sandcastle project took up the slack. Seems to be a bit laggy too these days btw.
I have a .exe app which I want to understand better - I can see it in reflector
Is there any way to get reflector to create a VS project with the code so I can view it properly in Visual Studio?
Nothing special is needed, it is built into Reflector, albeit not very discoverable. Right-click the assembly in the left pane and choose Export. You'll get a chance to change the output directory. Click OK and Reflector starts decompiling the code, creating a source file for each individual class. And creates a .csproj file which you can open in Visual Studio.
Check out Jason Bock's FileGenerator, it might be what you are looking for.
I've used Denis Bauer's Reflector.FileDisassembler http://www.denisbauer.com/NETTools/FileDisassembler.aspx. It works well enough to compile and step through the code.
Yea there is, but it doesn't come cheap
http://www.remotesoft.com/salamander/
I have used it to decompile assembly, but I've never used the feature to decompile it into a project so can't give you a review on that. The quality of the decompiler will match the one in reflector.
They also be some legal issues associated with decompiling exe into project - and source for recompilation, so use it with care.