How do I export the code documentation in C# / VisualStudio 2008? - c#

I have always made a point of writing nice code comments for classes and methods with the C# xml syntax. I always expected to easily be able to export them later on.
Today I actually have to do so, but am having trouble finding out how. Is there something I'm missing? I want to go Menu->Build->Build Code Documentation, but there is no option to do that, there.

Actually it's in the project properties. Build tab, Output section, XML documentation file, and enter the filename. It will be built on every build of the project.
After that you can build the actual help with Sandcastle.

You could try NDOC or SandCastle if you dont mind using 3rd party tools.

Sandcastle works pretty well for generating documentation and it supports a couple different formats for the generation. As far as I know, there isn't any Visual Studio integration for it, but there is a SandcastleGUI for it that is available.

Be careful if you're using LINQ to SQL as you won't be able to easily add sustainable comments to the auto-generated objects.

Late comment, but worth adding that even though Sandcastle is mothballed, the Sandcastle Help File Builder remains in active development, and I found it very powerful and straightforward to dive into when dealing with just this situation--install to rich .chm and .html/.asp output in a couple hours.

The previous answers are really out of date. Here are some more modern options:
DocFX: This is probably your best bet because it runs on Linux, macOS, and Windows and it's supported by the .NET Foundation.
Sandcastle Help File Builder (SHFB): This one is still supported but it might not be as active.

The original NDoc project (mentioned by others) is dead, but there is a new project called NDoc3.
NDoc3 supports .NET 2.0 - 3.5. It is currently available as a beta version and worked great for me. I'm not sure if the project is still active - the last beta was release in april 2009.

Related

VS Code Intellisense not showing suggestions in C#

Intellisense in VS Code only shows the previously used keywords and identifiers(in the current program) and not suggesting the new ones.The autocomplete only suggests the previously used keywords and identifiers.
Disabling the c# extension then re-enabling and restarting the vs code solves this issue for me
This will help you buddy.
C# language support is an optional install from the Marketplace.
You can install it from within VS Code by searching for 'C#' in the Extensions view (Ctrl+Shift+X) or if you already have a project with C# files, VS Code will prompt you to install the extension as soon as you open a C# file.
Visual Studio Code uses the power of Roslyn and OmniSharp to offer an enhanced C# experience.
So to summarize, you will need two things to do dotnet development using C#.
Install .NET Core.
Install the C# extension from the VS Code Marketplace.
Refer: https://code.visualstudio.com/docs/other/dotnet
Refer: https://code.visualstudio.com/Docs/languages/csharp
While I can see this is a minor problem and rather annoying - VSCode will do this. It's what makes it different to (IE) Visual Studio (Community / Enterprise).
Since I use both I had to look for a solution myself. I currently use the package 'All Autocomplete' by Atishay Jain (https://github.com/atishay/vscode-allautocomplete).
Good luck coding!
Quick edit:
It will still not give you back all options for a class if there's no instance of that class (OO).
I closed VSCode, removed the workspace file and when I re-opened the folder with vscode with it asked me if I wanted to use a particular project file or read all project files in the folder.
Either choice would probably be fine as you will have been so annoyed by this issue, you would not get up to creating a second project :)
I have installed BrackedPairColorizer and when I deleted this extension form VS Code it helps and editor start suggesting code after reload.
I had this issue, solution for me was downgrading the C# extension from v1.25.0 to v1.24.1
Other versions may also work but this was the first that I tried

How to format Visual Studio XML documentation for display on the web

I am using Visual Studio 2010 and have started being a good boy and documenting all my code as I write it, via XML comments. I have a well-documented project and I even figured out how to make Visual Studio spit out a complete XML document when doing a build. My question is, what is the best way to format/display this document on the web so that it appears in a nice friendly and usable format like MSDN? Is there a tool that does this easily?
Thanks in advance!
Check out Sandcastle.
Sandcastle produces accurate, MSDN style, comprehensive documentation by reflecting over the source assemblies and optionally integrating XML Documentation Comments.
Wikipedia has more information and links to additional projects that integrate with sandcastle.
Another option (which appears to be much easier to use) is docu:
A documentation generator for .Net that isn't complicated, awkward, or difficult to use. Given an assembly and the XML that's generated by Visual Studio, docu can produce an entire website of documentation with a single command.
A third option is NDoc:
NDoc generates class library documentation from .NET assemblies and the XML documentation files generated by the C# compiler (or with an add-on tool for VB.NET).
NDoc uses pluggable documenters to generate documentation in several different formats, including the MSDN-style HTML Help format (.chm), the Visual Studio .NET Help format (HTML Help 2), and MSDN-online style web pages.
Check out Sandcastle Help File Builder. This is a GUI tool that makes Sandcastle pretty easy to work with. It will install to a folder in Start Menu->Program Files->Sandcastle Help File Builder.; It's pretty easy to use, but it's not incredibly fast.
Hope that helps!
NDoc is also an option. But i would go with sand castle and that was what i did.
I have created an Open source project to expose them in WebPages
Check # AutoHelp
AutoHelp reads the DLL & XML Doc files, generates help pages and exposes them to the users.
AutoHelp uses ASP.NET MVC 5, ASP.NET WebApi, TypeScript, jQuery and Bootstrap to be a modern web app.
In 2020 you probably want to go with doxygen. Works like a charm for my .NET Core project.
Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice flavors), Fortran, VHDL and to some extent D.
Doxygen can export to HTML, LaTeX, RTF (MS-Word), PostScript, hyperlinked PDF, compressed HTML, and Unix man pages. The documentation is extracted directly from the sources.

Which C# IDE offers the most extensive AST access?

the core part of the bachelor thesis which I am writing right now is a plugin for a C# IDE that offers a few refactorings (it comes to more than simple refactorings but I want to keep it simple for the moment).
I've always been working with Visual Studio so far. However, I've heard that their AST access is rather uncomfortable.
Alternatives are MonoDevelop and SharpDevelop. Another way to work with Visual Studios AST would be to access it via a custom ReSharper Plugin.
Does anyone of you have experience in writing Plugins for any of those target applications? What do you think? I appreciate every advice and disadvice.
Thanks,
TH
An advantage of using MonoDevelop or SharpDevelop is that they're open-source, so you can be sure to have full access to the AST - you can go into the core and modify things, if necessary. Another advantage is that they're 100% managed code, so much easier to develop and debug. Plus, you're more likely to be able to get hold of core developers and ask them detailed questions.
If you're interested if working with MonoDevelop, I'd recommend you implement your refactoring directly in the existing Refactoring addin. We'd love to have more refactoring features :)
The codebase has been undergoing a bit of churn in master because we switched to a new AST and a parser based on the Mono C# parser, and the refactorings have not yet been ported over. I'd recommend you head over to our mailing list or IRC and ask some more specific questions there, so we can give you some more specific pointers.
I believe VS 2010 has very good native support for plugins using MEF. Here's a guide:
http://msdn.microsoft.com/en-us/library/dd885242.aspx
You can also use Devexpress DXCore, it's free with CodeRush Express.
The best AST access for refactorings is offered by NRefactory 5, a complete rewrite of the previous NRefactory version (which is used in both SharpDevelop and MonoDevelop).
For SharpDevelop we plan to use the new NRefactory in SharpDevelop 5.0; and MonoDevelop will also migrate to it eventually (MonoDevelop is already using the new AST, but not yet the new type system/semantic analysis).
The main goal for this rewrite was to:
Provide a rich AST with position information for every token, making refactorings easier to write
Improve the semantic analysis performance
Eliminate some bad design decisions from the previous version (IExpressionFinder, and how referenced assemblies are handled)
In the future, you might also want to look at Microsoft's Compiler-As-A-Service.
Also be sure to checkout ReSharper from http://www.jetbrains.com/resharper which is a plug-in for VS that adds many refactorings

Version Control in Visual Studio

I'm currently working on a large project, and am about to make some large changes, and was looking for a way to 'backup' my prior work. Is there built in functionality in Visual Studio to work with version control?
This project is developed only by me, and doesn't use Team Foundation Server (which is what most of my googling seems to give me answers on). Ideally, I would like to identify and restore all the different versions of my program as it evolves, without having to worry about totally messing something up...
Cheers and thanks in advance!
---EDIT---
With a version control system though, would that be stored on a seperate server? Or is it possible to store it locally? I'm more just concerned that I will just seriously mess up my code and not be able to undo it at some point...
There are several third-party source control integration tools, such as AnkhSVN or VisualSVN for SVN repositories (I use the former and can gladly recommend it). As far as "built-in", Visual Studio supports Team Foundation Server and Visual Source Safe out of the box, but those are both paid products and VSS should be avoided (in my opinion) for any new work.
Personally, I use TortiseSVN (for Windows integration) and AnkhSVN (for VS integration) with our SVN repository. There are free SVN servers as well, so you can get by with a very good solution while paying $0.
Well, there are a number of free source control alternatives out there and there are plug-ins (free ones) into Visual Studio that will allow you to hook right in. Take a look at those links and pick one that works for you!
Visual Studio has the ability to work with many source control providers. You simply have to hook them up.
Use "Tools->Options->Source Control->Plug-in Selection".
You may be able to use git with VS which means you don't need another dir/server etc for the repo. Consider Using Git with Visual Studio
TFS is really expensive, especially for just you. You can use VisualSVN.
it is a free download to us ANkhsvn. It is a plugin for visual studio that connects to various source control severs. You would first have to have a subversion server setup somewhere. Which is easy enough to do.
There is no built-in Version Control System in VS.NET, however, VS.NET supports multiple version control systems, like TFS, Visual Sourcesafe, SourceGear vault , etc...
As you state, you need a version control system. Look at this answer on selecting a Version Control System.
There are many version management systems. A lot of them are expensives, but... the are many others that are free! Take a look here:
http://producingoss.com/en/vc-systems.html
You can use SVN (Subversion) - one of the most used widely.

Checkstyle for C#?

I'm looking to find something along the lines of Checkstyle for Visual Studio. I've recently started a new gig doing .NET work and realized that coding standards here are a bit lacking. While I'm still a young guy and far from the most experienced developer I'm trying to lead by example and get things going in the right direction.
I loved the ability to use Checkstyle with Eclipse and examine code before reviews so I'd like to do the same thing with Visual Studio. Anyone have any good suggestions?
Another thing I'd be somewhat interested in is a plug-in for SVN that disallows check-in until the main coding standards are met. I do not want people checking in busted code that's going to wind up in a code review.
Any suggestions at this point would be great.
Have you tried StyleCop?
http://code.msdn.microsoft.com/sourceanalysis
Note: This's been moved to https://github.com/StyleCop
Take a look at resharper.
We use StyleCop to enforce our coding standards. It is free and integrates nicely with Visual Studio
What you're looking for is called Static Code Analysis.
FxCop is one option. I think Resharper can check this kind of thing as well.
Here are some of the great tools you can use
FxCop is a code analysis tool that checks .NET managed code assemblies for conformance to the Microsoft .NET Framework Design Guidelines
ReSharper is a refactoring and productivity plugin by JetBrains that extends native functionality of Microsoft Visual Studio .NET 2003, 2005 and 2008.
StyleCop is a free static code analysis tool from Microsoft that checks C# code for conformance to StyleCop's recommended coding styles and a subset of Microsoft's .NET Framework Design Guidelines
ref: http://blogs.msdn.com/fxcop/
Have you had a chance to review StyleCop
If you are looking for a long term supported version, I would recommend to look to Roselyn analyzers. They are the native support for Static Code Analysis with pre-configured rules, custom configs, and allow extensions.
According to the docs: “.NET compiler platform (Roslyn) analyzers inspect your C# or Visual Basic code for code quality and style issues.”
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview

Categories