Sandcastle 支持代码合约吗?
我的库使用代码契约。
有没有办法将这些合同合并到 sandcastle 生成的文档中?
My library uses code contracts.
Is there a way to incorporate these contracts in the documentation generated by sandcastle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
编辑:原来这个方法已经过时了;只需安装Sandcastle Styles。
Sandcastle 本身不支持它,但代码合约附带了所需的文件。
首先确保您正在为程序集生成文档,然后在项目的“代码合同”设置中,将“合同引用程序集”设置为“构建”,并选中“将合同发送到 XML 文档文件”复选框。
接下来,在 32 上打开
C:\Program Files (x86)\Microsoft\Contracts\Sandcastle\Sandcastle.zip
(或仅打开C:\Program Files\...
位安装 - 与下面的说明相同)。您需要提取的内容取决于您是通过 MSI 安装 Sandcastle 还是通过源代码安装 Sandcastle(它们实际上是不同的版本):
msi\vs2005\
下的所有内容提取到C :\Program Files (x86)\Sandcastle\Presentation\vs2005\
,并覆盖所有冲突。source\vs2005\
下的所有内容提取到C:\Program Files (x86)\Sandcastle\Presentation\vs2005\
,并覆盖所有冲突。最后,您需要创建一个新 Sandcastle 项目。您可以导入您的主题和内容向导中旧设置的设置。
然后您应该能够运行 Sandcastle 并在文档中包含合约。
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 justC:\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):
msi\vs2005\
toC:\Program Files (x86)\Sandcastle\Presentation\vs2005\
, and overwrite any conflicts.source\vs2005\
toC:\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.
它确实可以与 Sandcastle 一起使用,尽管需要进行一些调整才能将它们完全集成。请参阅 2011 年 2 月 4 日(或更高版本)代码合同用户手册中的第 8.3 节,网址为 http://research.microsoft.com/en-us/projects/contracts/userdoc.pdf
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
答案现在已经过时了。
Sandcastlestyles 现在似乎已被弃用,如果您尝试将最新的 Code Contracts 发行版(截至 2013 年 9 月 13 日)提供的补丁应用到最新的 Sandcastle 发行版,那么它可能会破坏 Sandcastle,因为该补丁不再与沙堡版本。
The answers are now out of date.
Sandcastlestyles now seems to be deprecated, and if you try to apply the patch supplied with the latest Code Contracts distribution (as of 13 Sep 2013) to the latest Sandcastle distro, then it will break Sandcastle presumably because the patch is no longer in sync with the Sandcastle release.