Sudheer Kumar

ASP.Net, C#, BizTalk, MSBuild, WPF, WCF, WF....
posts - 28, comments - 110, trackbacks - 16

My Links

News



Archives

Post Categories

Visual Studio 2005 - Documentation Generation Using NDoc 2005

 

Recently I have been designing an Application Framework in .NET/ASP.NET 2.0.

It went well and I was thinking of generating the documentation using Visual Studio 2005 as I used to do in VS 2003. I could not find something like “Build Comment Web Pages” under Tools and I realized that that option has been removed in 2005.

MS talks of automating a lot of things and getting less and less work done for the developer and instead of improving that feature, it was totally removed.

I searched for some alternatives and the following came as options:

  1. Write Custom XSL sheets
  2. HelpStudio Lite from Innovasys that is shipped as a part of  VS2005 SDK
  3. NDoc for Visual Studio 2005

I found some examples that shows writing XSLs for generating the HTML files, but I felt that will be kind of an over kill. . I was looking for a solution that can generate HTML/CHM help files directly from a Visual Studio 2005 Solution.

The second option, HelpStudio Lite, the basic functionality is free when you install the 2005 SDK, but since it is not integrated with the VS 2005 Projects, it is of not much useFor this functionality, you have to buy the product Document! X from Innovasys.

(http://www.innovasys.com/products/dx5/overview.asp). The single license version of this tool costs arnd $550.

So I decided to try NDoc and it turned out to be working well.

Here are the steps to get it working.

 

  1. Download the NDoc2005

Download the Beta Source code (as of now) from :

http://prdownloads.sourceforge.net/ndoc05/

 

Please make sure to download the Source Code and not the binaries. The binaries on running gave me an error:

 

Exception: System.IO.DirectoryNotFoundException

Could not find a part of the path 'D:\Documenter\Msdn\xslt\namespace.xslt'.

 

This is a known issue as a result of path hard coding.

 

So the solution is to download the source code.

 

  1. Compile the NDoc2005 Source Code
  2. Generate Documentation

 

Now DONOT try to run the NDoc Application by clicking F5. I did that initially and I had a solution that had around 5-6 projects. It was failing giving an error: Falied to load Assembly…blah..blah..

 

So the solution is to run the NDocGui.exe from NDoc2005\src\Gui\bin\Debug path.

 

Now before starting the generation, you need to enable the XML document generation for each project in VS 2005(Project Properties->Build->Output->XMlDocumentationFile)

Now add the decoration for you class and methods.

 

I found some good article on this at:

http://www.codeproject.com/csharp/csharpcommentinganddocs.asp

which could be a good starting point.

 

Now run the NDocGui.exe and specify ur solution name. It took a good amount of time to convert, but it is really fantastic.

You get the MSDN style documentation, very neat and clean.

Thanks a lot to NDoc..!!

 

So happy documentation to all..!!!

 

 

 

Update : 07-25-2006:

 

I made a wrong statement in my last post:

DONOT try to run the NDoc Application by clicking F5.

So the solution is to run the NDocGui.exe from NDoc2005\src\Gui\bin\Debug path

It is one and the same and I find, it was made bcose of some bad assumptions.

 

But afterwards, it was failing to generate the documentation giving an exception :

Falied to load Assembly

 

It was failing inside:

NDoc2005\src\Documenter\Msdn\MsdnHtmlUtilitiesV20.cs

for the method : InitializeNamespaces()

 

When I analyzed the code, I found that , it is failing to load the dependent assemblies of the assembly for which documentaion need to be generated. The reason is that the Assembly.LoadWithpartialName(name) will try to load the assembly from the AppDomain’s bin directory or from any of the configured path. This assembly is the one, whose path may be no way related to that of the NDocGui.exe.

So I decided to use the following logic:

  1. Load the dependent assembly from the CodeBase of the main assembly. This assunes that the dependent assemblies will be there under the bin of the main assembly
  2. But this logic will fail for the GAC assemblies like mscorlib, System.Data which are also dependent assemblies. So in the catch() block, I tried to load them with FullName.

And this worked and the documentation works like a charm now..!

Here is the full function I modified. The modified being in yellow color.

 

File : NDoc2005\src\Documenter\Msdn\MsdnHtmlUtilitiesV20.cs

for the method : InitializeNamespaces()

 

///

        /// Initialize namespace dictionary

        ///

        public static void InitializeNamespaces(Project project)

        {

            // If we don't have namespaces list yet, go through each referenced assembly,

            // load the assembly, get the types, then cache the namespaces for all public types.

            if (namespaces.Count == 0)

            {

                foreach (AssemblySlashDoc doc in project.AssemblySlashDocs)

                {

                    //

                    string strDllFullPath = doc.Assembly.Path;

                    string strDllPath = strDllFullPath.Substring(0, strDllFullPath.LastIndexOf(@"\")+1);

                    //

 

                    Assembly theAssembly = Assembly.LoadFrom(doc.Assembly);

                    AssemblyName[] assemblies = theAssembly.GetReferencedAssemblies();

                    foreach (AssemblyName an in assemblies)

                    {

                        //Assembly assembly = Assembly.LoadWithPartialName(an.Name);

                        Assembly assembly = null;

                        try

                        {

                            assembly = Assembly.LoadFrom(strDllPath + an.Name + ".dll");

                        }

                        catch(Exception ex)

                        {

                            try

                            {

                                assembly = Assembly.Load(an.FullName);

                            }

                            catch (Exception ex1)

                            {

                                continue;

                            }

                        }

                      

                        if (assembly == null)

                        {

                            throw new System.IO.FileNotFoundException(String.Concat("Unable to locate the referenced Assembly ", an.Name));

                        }

                        Type[] assemblyTypes = assembly.GetTypes();

                        foreach (Type type in assemblyTypes)

                        {

                            if (type.IsPublic)

                            {

                                namespaces[type.Namespace] = type.Namespace.Replace('.', '_') + '_';

                                namespaces[type.Namespace.Replace(".", "")] = type.Namespace.Replace('.', '_') + '_';

                            }

                        }

                    }

                }

            }

        }

 

I am not sure whether this is the bext fix for the problem I faced with NDoc, but this makes it working..!!

 

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Monday, July 24, 2006 10:52 PM | Filed Under [ Visual Studion 2005 ]

Feedback

Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc2005

The VS 2005 Web Application Project option includes HTML documentation generation support. I'd recommend checking out that if you want to enable this.

Tutorials on using it can be found at: http://webproject.scottgu.com.

Hope this helps,

Scott
7/24/2006 5:49 PM | scottgu
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Since Microsoft release a set of tools called Sandcastle to generate documentation, a Visual Studio 2005 add-in has been developped by Process Academy. It's a free add-in.
8/7/2006 2:04 PM | ymethot
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

In VS2005, how to enable XML Documentation option? There is no sln file generated for website project in VS2005. Then how it is possible to generate documentation file for VS2005 project using NDoc?
11/28/2006 3:46 AM | Vimal
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I believe the code would be better if it checked the paths in the project reference path list in addition to the paths you have specified.
1/2/2007 1:38 PM | Brian
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

This UTILITY SHOULD NOT BE USED!!! After installing NDOC2005 as above and after setting the Build->Output->XMLDocumentationFile and after Clicking on Add and giving the path of your .dll (assembly file) of your project, i noticed that NDOC2005 actually, removes/deletes .cs file from my project.My .cs files got deleted and i spent about 2 hrs trying to recover them..with no luck, i had to recode back these files after taking the last checked-in file!!!
1/5/2007 3:31 AM | Lakshmi Murthy
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Thank you so much for posting this! I agree with Brian, it would be better if it actually checked the Reference Paths setting -- I did set that -- but it doesn't pick it up! I have been struggling with this "Falied to load Assembly..." crap for 2 days!! With the fix to the InitializeNamespaces() everything is running like clockwork again! Thanks again -- this was a life-saver!!!
1/30/2007 12:39 PM | Aubrey
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Hi Sudheer,

Everything is working fine for me after a lot of trouble but one thing.

I created a DLL of my project and input to NDoc. It did generate all the docs but didn't import any of the attributes (I only used summary, param and returns).

Please comment.
1/30/2007 3:25 PM | Ghazi
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I tried to the fix the code for NDoc as above and enter the dll I need to document. The process seems to be running quite fast at the start but then it hangs up
2/14/2007 9:59 AM | Dipty
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I have noticed once more thing in addition to my comment above. The documentation process stops when it comes across a overloaded function.
Any comments?
2/14/2007 10:10 AM | Dipty
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Here is my suggest for the code to fix, this way it uses the reference paths defined in the GUI to try to resolve them:
Assembly assembly = null;
try
{
assembly = Assembly.Load( an.FullName );
}
catch ( Exception )
{
//Do nothing
}
if ( assembly == null )
{
foreach ( ReferencePath rfpRefPath in project.ReferencePaths )
{
try
{
assembly = Assembly.LoadFrom( rfpRefPath.Path + "\\" + an.Name + ".dll" );
}
catch ( Exception )
{
//Do nothing
}
if ( assembly != null )
break;
}
}
2/27/2007 3:34 PM | Robert
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Thanks for sharing :)
3/23/2007 7:25 AM | ram shankar yadav
Gravatar

# Use sandcastle help file builder

Pingback from http://dotmad.blogspot.com/2007/04/help-file-generation-for-framework-20.html
4/1/2007 11:13 AM | Adi
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Actually there is one workaround for refrence path issue. in the GUI there is an option to specify reference path.
Specify the relative reference path first, and change it to Fixed path by using the option: FixedPath = True. Now change it back to FixedPath = False.
After this i did not fac any depending assemblies issue. Also in order to sove the issue:
"Could not find a part of the path 'D:\Documenter\Msdn\xslt\namespace.xslt'."

I just copied only the "Documenter" directory from the source code. I did not recompile the source code. it works fine with the copied Documenter directory

The only issue i had is: I ahve around 60 assmeblies for which i need to generate the help. NODOC 2005 took more than 10 hours to complete the job.
4/12/2007 12:46 AM | Venkat
Gravatar

# Generování dokumentace VS2005 přes NDoc

Tak jsem po dlouhé době pohledal, či se nepohl projekt NDoc pro VS2005 a FW2.0 a ejhle. Po trochu boji
6/14/2007 2:47 AM | ruprt
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

why not using VS's built in feature...
11/15/2007 5:16 PM | de jim
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Thanks a lot.. It works fine now.. I dont know why the developers of Ndoc have not yet fixed this issue.
12/5/2007 1:36 AM | Keerthi Ramanarayan
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I have changed code as you given above but it gives error "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property" during build documentation...
6/12/2008 10:40 PM | Rashmi Bhimani
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

NDoc Documenter Error

Exception: NDoc.Core.DocumenterException

One or more required assemblies could not be located :
Microsoft.WindowsCE.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac

The following directories were searched,
C:\MCInStore\Dev\MCClient\CartClientCE\CartClientCE\bin\Debug

I think application will not search assembly in system assembly forlder

6/12/2008 10:45 PM | Rashmi Bhimani
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I'm using NHibernate and visual Studio 2005. My question is I will have any problem for this if I use NDoc 2005.
6/13/2008 3:12 AM | Kristyn Rizzarf
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Hi,

I keep the error below when I try to build the source files.

Error 7 Unable to copy file "obj\Debug\NDoc.Core.dll" to "bin\Debug\NDoc.Core.dll". The process cannot access the file 'bin\Debug\NDoc.Core.dll' because it is being used by another process. Core


Natasha
6/10/2009 10:16 AM | Natasha S
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Hi

I am using asp.net website not webapplication. therefore i have never see any option to create xml output in project's property pages. I am using VS 2008 and and asp.net website. and want to create xml documentation of complete project at build time. Please Help me.





Thanks & Regards

Rohit Kumar Gupta
6/24/2009 11:53 PM | Rohit Gupta
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Save up to 60% on affordable tiffany jewelry, beautiful discount tiffany rings, tiffany necklaces,tiffany Pendants, tiffany earrings and tiffany Bracelets.
8/1/2009 8:16 AM | tiffany
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I think the code is right!
11/2/2009 9:15 PM | cheap fallen earth chips
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

It is very good .I like to see it.If you want to buy tibia gold,you can
go to see it.Have a good time.
1/11/2010 1:20 AM | tibia gold
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

This is a great article. I’m new to blogging but still learning.I love your blog!
6/8/2010 8:26 PM | Formal dress
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Thanks so much for the compliment. It means a lot to me to hear from people who enjoy the blog! Hopefully you will enjoy future posts just as much. So dont forget to subscribe to the blog.!
7/6/2010 1:29 AM | ed hardy bags
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

This is a good post, I stumbled across your article while looking for song downloads. Thanks for sharing, I’ll be sure to recommend this site to others.
7/15/2010 7:15 AM | ghd straighteners uk
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Good,I like it,thanks.
9/12/2010 8:50 PM | Ed Hardy Jackets
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I truly enjoyed this. It has been extremely informative as well as useful.thanks for sharing the information.
9/15/2010 1:18 AM | freelance writing jobs
Gravatar

# ed hardy

I truly enjoyed this. It has been extremely informative as well as useful.thanks for sharing the information.
9/29/2010 1:03 AM | ed hady
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

so great
10/22/2010 3:37 AM | chanel purses for cheap
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Tell me please what's your opinion about this awesome method to find exe files? I'm sure it will help many of you and you will thanks me for that later on.
10/31/2010 1:48 PM | easysaver
Gravatar

# Cost of Breast Implants in Asia

One of the most important things in a workplace is passion I also think about great athletes like top off the world.
11/3/2010 4:41 AM | stela
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

One of the most important things in a workplace is passion I also think about great athletes like top off the world.
11/3/2010 4:44 AM | Cost of Breast Implants in Asia
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Many thanks for this excellent plugin - this is really helpful for all those bloggers like me. Seems like you've got a really good blog full of information too. Thanks.
11/16/2010 8:37 PM | iphone cases
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

thank you for your sharing with us
11/16/2010 8:37 PM | iphone cases
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I agree! Payday loans are not a 'magic pill'. It all depends on the individual's credit history, current status and more importantly FUTURE intentions. Often it's better to eliminate debt. But as with anything, it's best to get assistance from a qualified debt professional.
11/19/2010 3:27 AM | white iphone 4
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I really enjoyed reading this post, big fan. Keep up the good work and
please tell me when can you publish more articles or where can I read
more on the subject? Thank you on behalf of the Administrative Resume team. we will really appreciate you for your upcoming blast
also.
11/27/2010 6:57 AM | Administrative Resume
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I really enjoyed it. It was very informative and useful. thanks for sharing the information.
11/27/2010 1:19 PM | Clickable Video
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

As I work for my הפצת קורות חיים company and while searching for this I recently found your nice site which is very cool nice and informational. This is the thing which I was searching from a long time but finally got it. thanks for this nice one
11/28/2010 11:06 PM | הפצת קורות חיים
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Your blog is very useful. Thank you so much for providing plenty of useful content. I have bookmark your blog site and will be without doubt coming back. Once again, I appreciate all your work and also providing a lot vital tricks for your readers
12/24/2010 11:17 AM | make nose smaller
Gravatar

# liajames

Great article with excellent idea! I appreciate your post.
2/3/2011 1:17 AM | sending flowers to south africa
Gravatar

# liajames

I like every post in this blog. Really a nice work has done. I appreciate the blog owner.
2/3/2011 1:22 AM | online gifts saskatoon canada
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I admired this argument and i appreciated. I’ve apprehend all.
2/16/2011 2:20 AM | ed hardy clothing
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Thank you so much for the kind words. And you are welcome.
2/22/2011 8:36 AM | Austin search
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I could say that this is awesome articles, really great representation that may benifit viewers like me. I would love to subscribe to your site to receive updates and to share more about our land for sale details.
2/24/2011 10:21 AM | freelance
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

thanks for your sharing
i really learn a lot
3/1/2011 1:26 AM | pre-pressing extraction
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Thanks for your useful info, I think it's a good topic. I’m interesting about your article, keep posting.
3/2/2011 6:00 AM | michigan car insurance
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

This is a good blog post. This post give purely and qualityfull information.I’m definitely going to look into it. Really very useful tips give here.
3/7/2011 10:34 AM | cheap auto insurance
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Very interesting and informative article. Read very easily. Such quality articles really very little now.
3/7/2011 2:12 PM | Retin A Without A Prescription
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

The Military Payroll Calculator is a very good example of how a macro can make dynamic document composition quick and easy with no need to add payroll calculations to the data source.
3/9/2011 11:26 AM | rachman
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Happy to see your blog as it is just what I’ve looking for and excited to read all the

posts.
3/10/2011 2:30 AM | PELLETMILL
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

It’s good to see this information in your post, i was looking the same but there was not any proper resource, thanx now i have the link which i was looking for my research.
3/17/2011 1:45 AM | 78726 Homes for Sale
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

thanks for providing the quality information as there are lots of sites that can just crack your head into pieces for its non-English texts.
3/17/2011 1:47 AM | betalkort
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

It's a good post.
3/30/2011 6:04 AM | idf
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Good post.
4/1/2011 3:07 AM | ice maker
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

The Expeditionary Amount Calculator is a rattling neat example of how a instruction can work slashing document printing intelligent and gentle with no require to add register calculations to the data communicator.
4/2/2011 7:58 AM | mlm
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

This is a good post. This post gives truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. Thanks you so much. Keep up the good works
4/5/2011 2:39 AM | Lago Vista Foreclosures
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

This is a good post.
4/6/2011 3:40 AM | lace wigs
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Excellent design concept and execution on your map and your discussion of the process was interesting. Thanks for posting this and making the files available.
4/8/2011 4:32 AM | pelletizing mill
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

No one can disagree about the importance of documentation. Despite this, the software development documentation does not always occur as it should be. Many reasons can be proposed for this, but despite all these reasons, contributing reason is the attitude of software developers themselves!
4/16/2011 2:11 PM | wooden bookcases
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

I certainly enjoyed the way you explore your experience and knowledge of the subject! Keep up on it. Thanks for sharing the info myefox. Austin TX MLS Search
4/23/2011 1:33 PM | Text: Austin TX MLS Search
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

The code that you have provided is extremely useful and you have produced a very clear and precise article.
Austin Roofing Contractor
5/15/2011 11:16 PM | ashu
Gravatar

# nice

And this worked and the documentation works like a charm now..!

Here is the full function I modified. The modified being in yellow color
7/3/2011 2:06 AM | Lake Travis Real Estate
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

very good information thinks to very much your site is best.
7/23/2011 3:52 PM | Lakeway Pool Homes
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

You deserve the best and I know this will just add to your very proud accomplishments in your already beautiful and deserving blessed life. I wish you all the best and again. Thanks a lot..<a href="http://crescent-processing.blog.co.uk/
8/12/2011 12:35 PM | Crescent Processing Company
Gravatar

# re: Visual Studio 2005 - Documentation Generation Using NDoc 2005

Thank you very much... 5 years later, it's still really usefull, including last correction....
10/27/2011 10:52 AM | marohds
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: