MSBuild 自定义任务“Hello World”演练
有人可以编写(或链接到)一个演练来准确解释如何创建自定义 MSBuild 任务并在构建期间运行它吗?我正在寻找一个继承自 Microsoft.Build.Utilities.Task
的自定义任务,并且只执行以下操作:(
public override bool Execute()
{
Log.LogMessage("Hello world!");
return true;
}
我已经为此工作了几个小时,并不断收到“[无论]任务找不到。检查以下“消息。我想我一定在某个地方错过了一个重要步骤。如果有一个清晰的教程我可以遵循,也许我会找出我的不足之处。)
Can someone write (or link to) a walkthrough that explains exactly how to create a custom MSBuild task and run it during a build? I'm looking for a custom task that inherits from Microsoft.Build.Utilities.Task
and does only this:
public override bool Execute()
{
Log.LogMessage("Hello world!");
return true;
}
(I've been working on this for hours and keep getting the "The [whatever] task was not found. Check the following" message. I think I must be missing an essential step somewhere. If there's a clear tutorial I can follow, perhaps I'll figure out where I'm falling short.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅
See
您是否在 MSBuild 项目文件中声明自定义任务?您需要这样一行:
然后 MSBuild 可以执行您的任务。
Are you declaring your custom task in your MSBuild project file? You need a line like this:
Then MSBuild can execute your task.