Nate McMaster shows how to write your own MSBuild tasks in C#. Since you're developing your tasks in C#, you can use standard .NET libraries, debug your code, etc. The code for this episode is available here: https://github.com/CodeConversations/MSBuild-Features-With-Nate-McMaster/tree/master/Video-1