views:

44

answers:

1

My library uses code contracts.

Is there a way to incorporate these contracts in the documentation generated by sandcastle?

+2  A: 

Edit: Turns out this method is outdated; just install Sandcastle Styles.

Sandcastle doesn't support it natively but Code Contracts comes with the required files.

First ensure you are generating documentation for your assembly, then in the Code Contracts settings for your project, set Contract Reference Assembly to 'Build', and check the box for "emit contracts into XML doc file".

Next, open C:\Program Files (x86)\Microsoft\Contracts\Sandcastle\Sandcastle.zip (or just C:\Program Files\... on a 32-bit installation - and the same for the instructions below).

What you have to extract depends on whether you installed Sandcastle with the MSI or from source (they're actually different versions):

  • if from the MSI, extract everything under msi\vs2005\ to C:\Program Files (x86)\Sandcastle\Presentation\vs2005\, and overwrite any conflicts.
  • if from source, extract everything under source\vs2005\ to C:\Program Files (x86)\Sandcastle\Presentation\vs2005\, and overwrite any conflicts.

Finally, you need to create a new Sandcastle project. You can import your topics & settings from the old one in the wizard.

Then you should be able to run Sandcastle and have contracts in the documentation.

Porges
Actually, all you have to do is install the http://sandcastlestyles.codeplex.com/(see http://social.msdn.microsoft.com/Forums/en-US/codecontracts/thread/49f64a19-fd3b-45a9-8d4e-d59eacf0f0d5)Thank you for pointing me in the right direction.
Well that's easier :) I was going by the documentation that comes with Code Contracts.
Porges