I've been using CopySourceAsHTML for some time now to add source code to my blog posts. Until recently, you could find it on GotDotNet.Com. But that site has now shut-down. Fortunately, the author sent me the new link for a download of this excellent tool.
I know a lot of you have trouble setting it up when using it to copy source code to your Community Server blog. I therefor updated this blog post with the correct URL's and moved it back to the top of my blog posts. This blogpost describes the settings I currently have and that allow me to quickly paste code into my blog.
After installing CopySourceAsHTML, you get the option "Copy as HTML.." when you right-click on a selection in your code. When you choose that option, you get the following window:
Here you see my current default settings. When you change your settings to match these you can use my CSS code. In the File Style Tab, add the following css overrides:
border-top: windowtext 1pt solid;
border-left: windowtext 1pt solid;
border-right: windowtext 1pt solid;
border-bottom: windowtext 1pt solid;
Click OK and you're ready. You have the HTML for the code you selected in your clipboard and you can paste it directly in your blog post.That's all. Your code looks great, as you can see in this example, you get scroll bars when it doesn't fit the browser window width and, of course, syntax highlighting.
These settings work for both VS 2003 and VS 2005. Since it relies completely on the CSS information above, it will not interfere with other stuff.
If you want to limit the height of your <div> section, then this is of course no problem. Simply change the HTML for the blogpost and do something like this:
<div style="HEIGHT: 150px">
I've written a few articles on CodeProject (see: My Articles) and I find a lot of examples for my work there too. I check CodeProject regularly, especially if I'm trying to figure out how to solve a particular problem. I was therefor very happy to be pointed to the Code Project Browser Add-In created by one of the developers at SlickEdit.
When I find an example I like to test on CodeProject I always need to take the following steps:
Logon to CodeProject.
Download the zip file containing the sources.
Extract the zip file.
Open the project.
The Add-in does all that for you. Once you have installed it, a new menu item appears in the Tools menu
When you select that menu item, a new tab is added to the ones already there, which may contain your code or designer windows. If it's the first time you've started this menu item, the browser will ask for your email address and password which it needs to logon to the CodeProject web site. What you then see is basically your normal webbrowser. You can now browse the CodeProject website for code you're interested in.
Once you've found the article you're interested in, simply click on the download link. You will get the following dialog:
Click Yes, and the Code Project Browser will download the zip file to your system. It will extract all the code and load the project into Visual Studio and you're ready to compile the downloaded project. The Code Project Browser has it's own window that will show you all the projects that you've downloaed in this way:
I really like it and I've only been using it since this morning. If you're a regular visitor of Code Project and download code from that site, then you have to give this add-in a try. I'm sure you'll love it as much as I do.
You should by now be aware that Microsoft is developing a documentation compiler called Sandcastle. Although the project is still very much in CTP mode, I do believe that it gives you all the options you need to generate documentation for your managed code assemblies. To help you achieve that, I have previously suggested the use of Sandcastle Help File Builder. And it's still a great option it you're looking for something to replace NDoc.
But a new star is on the horizon called DocProject. I've started using it about a week ago and it has a number of very powerful features which I really like:
The tool integrates seamlessly with Visual Studio 2005 and adds two project templates which will help you create documentation for your solution. When you add the documentation project to your solution, a wizard will help you setup the project and add the managed assemblies in your solution to the documentation project. Once that is done, recompiling the solution is enough to generate the documentation.
There's also an external GUI which resembles the NDoc interface. Using this tool, Visual Studio Express users can also use the tool to create documentation.
The API Topic Management Dialog provides a GUI for choosing the API topics that will be built by Sandcastle. It allows a user to include or exclude namespaces, types and almost any member topic using regular expressions or categorical filters. It also provides the ability to create external XML documentation for the project, namespaces and API elements in soure mode and design mode.
The tool makes creating and deploying a Documentation Web site really simple.
The tool uses MS-Build to actually build the documentation and the integration in VS 2005 allows you to integrate Sandcastle in your daily builds using TeamServer.
The project site on CodePlex offers plenty of documentation and tutorials to get you started.
If you're interested in generating documentation for your managed assemblies without too much hassle, then you really need to check out DocProject. Here are some links to get you started:
Installation, Configuration and Uninstallation