msbuild - 你如何编写一个 MSBuild 任务来支持取消?

标签 msbuild msbuild-task

我有一个针对 xUnit.net 的自定义 MSBuild 任务。当任务运行时,如果我按 Ctrl+C,它会“尝试”取消任务,但它当然会失败(因为我的任务不支持取消)。再多的 MSDN 文档搜索或 Google-fu 都没有找到解决方案。由于我找不到一个明显的接口(interface)来实现,我猜可能通过某种约定来支持取消。

有没有人这样做过,并且知道取消工作需要什么?

最佳答案

我知道您非常了解任务层次结构,但很可能这就是您正在寻找的内容,只是您没有实现 ToolTask 的事实。 ...

Inside MSBuild 2nd ed说(p118)ToolTask.Cancel

This method is called to cancel the task execution. Once this method is called by MSBuild, if the task does not complete, it will be forcefully terminated



其中没有其他关于取消的引用。

关于msbuild - 你如何编写一个 MSBuild 任务来支持取消?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9865982/

相关文章:

iis - msbuild-未经授权的AccessException : Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344

.net - "Message"任务未找到

azure - 用于 Selenium 测试的 Team Foundation 服务器自定义托管构建 Controller

MSBuild ITaskItem RecursiveDir 元数据消失

msbuild - 使用 msbuild 命令行在指定路径中发布网站

msbuild xmlupdate 删除 web.config 中的节点

msbuild - 错误 : More than one package matched with specified pattern: D:\a\r1\a\**\*. zip。请限制搜索模式

compiler-construction - 在Visual Studio 2013中写入输出构建 Pane +错误列表,无需双击即可使用msbuild/new进程双击条目以出错

在 vscode 中调试 C# 源代码生成器

.net - MSBuild建立默认值以调试配置