Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Sandcastle support code contracts?

My library uses code contracts.

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

like image 707
user380719 Avatar asked Feb 26 '23 09:02

user380719


2 Answers

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.

like image 186
porges Avatar answered Mar 01 '23 01:03

porges


It does work with Sandcastle though there are some tweaks necessary to integrate them fully. Refer to section 8.3 in the Code Contracts User Manual dated 2/4/2011 (or later) available at http://research.microsoft.com/en-us/projects/contracts/userdoc.pdf

like image 37
Dave Black Avatar answered Mar 01 '23 01:03

Dave Black