MSBuild Task for Hello World Custom Tasks

Can someone write a (or link) walkthrough that explains how to create a custom MSBuild task and run it during build? I am looking for a custom task that inherits from Microsoft.Build.Utilities.Task and does just that:

 public override bool Execute() { Log.LogMessage("Hello world!"); return true; } 

(I have been working on this for several hours and keep getting the β€œTask [independently]]. Check out the following message. I think I should miss some important step somewhere. If there is a clear guide, I can follow, perhaps I will find out where I can’t.)

+8
msbuild msbuild-task
source share
2 answers

Do you declare your own task in the MSBuild project file? You need a line like this:

  <UsingTask AssemblyFile="C:\PathTo\MyTasks.dll" TaskName="MyTasks.HelloWord" /> 

Then MSBuild can complete your task.

+6
source share

Cm.

+4
source share

All Articles