Build Sandcastle Documentation When Building Visual Studio Project

淺唱寂寞╮ 提交于 2019-11-29 09:24:01

问题


I am using the Sandcastle Help File Builder to output my C# XML-DOC file to the Website format. How can I accomplish the samething from the command line so that I can add this as a build event in Visual Studio when building the actual project?

The end goal is to have the website Help File content built when I build the Visual Studio project.


回答1:


As Scott Wylie indicated, you need to specify this in the post build event command line in Visual Studio's project properties. However, I would suggest using Sandcastle Help File Builder (SHFB) rather than Sandcastle directly. It makes the command line call short and simple as shown below, but note that first you have to configure the SHFB project with the SHFB GUI, which creates an msbuild-compatible build file with the ".shfbproj" suffix:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
        /p:Configuration=Release myProject.shfbproj

However, note that I take the opposite approach from what you are doing: instead of using Visual Studio to interactively launch a build and ancillary actions, I use ant (nant) to launch a build of everything, which includes my Visual Studio solutions and subsequent SHFB action. So this is really the command-line call I make to build the documentation with Sandcastle:

<exec executable="${msbuild}" dir="${csharpdoc}" output="${csharpdoc.log}">
    <arg value="/p:Configuration=Release"/>
    <arg value="myProject.shfbproj"/>
</exec>

My preference is that the entire build should be launchable from the command line so there are no interactions required (e.g. launching Visual Studio, etc.). That provides the flexibility to run either as a scheduled recurring task or on-demand from the shell.




回答2:


You could call SandCastle from the post build event command line, in the Build Events section of your project properties. This should work nicely if you are not using any automated build tool.




回答3:


If you're using MSBuild for your build tool this is the tutorial I used awhile back.

There is also a script on codeplex that you can look into using that might help you out.

Hope this helps!




回答4:


I found it easiest to just add the *.shfbproj project to the solution. It builds fine (although a bit slowly) inside of VS 2010.



来源:https://stackoverflow.com/questions/7882746/build-sandcastle-documentation-when-building-visual-studio-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!