构建 Visual Studio 项目时构建 Sandcastle 文档

发布于 2024-12-11 10:31:08 字数 153 浏览 0 评论 0原文

我正在使用 Sandcastle 帮助文件生成器将我的 C# XML-DOC 文件输出为网站格式。如何从命令行完成相同的操作,以便在构建实际项目时将其添加为 Visual Studio 中的构建事件?

最终目标是在构建 Visual Studio 项目时构建网站帮助文件内容。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

于我来说 2024-12-18 10:31:08

正如 Scott Wylie 所指出的,您需要在 Visual Studio 项目属性的构建后事件命令行中指定这一点。但是,我建议使用 Sandcastle 帮助文件生成器 (SHFB),而不是直接使用 Sandcastle。它使命令行调用变得简短,如下所示,但请注意,首先您必须使用 SHFB GUI 配置 SHFB 项目,这将创建一个带有“.shfbproj”后缀的与 msbuild 兼容的构建文件:

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

但是,请注意,我采用与您正在做的相反的方法:我不使用 Visual Studio 交互式启动构建和辅助操作,而是使用 ant (nant) 启动所有内容的构建,其中包括我的 Visual Studio 解决方案和后续的 SHFB 操作。所以这实际上是我使用 Sandcastle 构建文档时进行的命令行调用:

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

我的偏好是整个构建应该可以从命令行启动,因此不需要交互(例如启动 Visual Studio 等)。这提供了作为计划的重复任务运行或从 shell 按需运行的灵活性。

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.

青朷 2024-12-18 10:31:08

您可以在项目属性的“构建事件”部分中从构建后事件命令行调用 SandCastle。如果您不使用任何自动构建工具,这应该可以很好地工作。

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.

哽咽笑 2024-12-18 10:31:08

如果您使用 MSBuild 作为构建工具,则这是 教程 我之前用过一段时间。

codeplex 上还有一个脚本,您可以研究一下,使用它可能会对您有所帮助。

希望这有帮助!

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!

绳情 2024-12-18 10:31:08

我发现最简单的方法是将 *.shfbproj 项目添加到解决方案中。它在 VS 2010 中构建得很好(尽管有点慢)。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文