Using an IDE, especially one like VS.NET 2005, has its faults. You get used to intellisense so much that when that little list doesn’t pop up you feel righteous anger. So, one of the first things I did when I started writing custom tasks for MSBuild was to investigate the possibility of adding intellisense for my tasks. And it turns out that it’s a cakewalk.
All you need to do is goto %Program Files%\Microsoft Visual Studio 8\Xml\Schemas\1033 and open up the file Microsoft.Build.xsd. This file has the schema definition for http://schemas.microsoft.com/developer/msbuild/2003.
We will extend this schema and let it know about our tasks as well. This is the basic structure of a task definition.
<xs:element name="MyTask" substitutionGroup="msb:Task">
<xs:attribute name="MyParameter" type="xs:boolean" use="required"/>
Just substitute the name of your task in the xs:element tag and add the parameters that your task supports as xs:attribute tags
Create a separate schema definition file with your custom task descriptions and then include that file in Microsoft.Build.xsd:
The custom tasks schema file will start like this
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:msb="http://schemas.microsoft.com/developer/msbuild/2003" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/developer/msbuild/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="Microsoft.Build.Core.xsd" />
And that’s it you are done!
In your proj files just ensure that you are using the MSBuild namespace:
Start typing the name of your custom task and voila!