Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Throwing Custom Compiler Warnings when writing custom Msbuildtask

I am using msbuildtask to validate an xml file on Build. I am able to do that using the Execute method after extending Task. Am not able to display Custom Warnings or messages stating the reason for build fail. Is there any custom way to throw compiler warning from code?

like image 990
Access Denied Avatar asked Dec 05 '25 15:12

Access Denied


1 Answers

I found that using ITask interface gives us some additional power of interaction with Msbuild engine than Task interface.

  • Implement ITask interface for a class and add Code to perform ur task in Execute Method of it.
  • Add this task in the csproj.
  • When implementing ITask interface there is a way to contact the compiler and pass it Messages or Warnings or Errors. Here is a basic example of a class which implements ITask interface http://blogs.msdn.com/b/msbuild/archive/2006/01/21/515834.aspx
like image 142
Access Denied Avatar answered Dec 10 '25 21:12

Access Denied