I have written the c# comments of my function,and then i gave the dll file to my friends who need it,but when he use those functions ,he can't see the comments,how to solve this problem?
Ps: I can see the comments when i use it in my project;
Comments are ripped off the assembly, you'll have to generate the xml documentation for your project and give it to your friend. If both files (assembly and xml documentation) are in the same directory Visual Studio will use the documentation in IntelliSense.
(Xml documentation can't be embedded in assembly)
You need to build the XML documentation file for the project as well (tick the box in the Build part of the project properties) and give your friends that file as well as the DLL.
If they put the two files in the same directory, Visual Studio will pick up the documentation automatically and show it in IntelliSense etc.
Note that this will only pick up XML comments (the ones started with /// or /**), not regular comments.
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 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#).
Suppose you have a C# library with several functions, all documented with the usual /// <summary> filled out nicely. Referencing the project will make the function and parameter description appear in the Visual Studio contextual help. But is it possible to have this show if you don't reference the project itself, just a build (and potentially some other file that has the documentation inside)?
Yes there is - the library needs to be built with the "XML Documentation file" tickbox checked (in the project property pages)
With this option ticked the build process will now build an extra XML file in the output directory which contains all of the xml documentation - whenever Visual Studio references an assembly by file it will load and show intellisense documentation from this XML file (if it can be found).
You should distribute this file alongside (in the same directory as) your compiled library.
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.