How do I extend the schemas used by the VS XML editor to give intellisense on projects?
There are 3 schemas:
-Microsoft.Build.Core.Xsd (the core
MSBuild elements and attributes)
-Microsoft.CommonTypes.Xsd (the properties and items that Visual Studio uses, and the tasks that
MSBuild ships with)
-Microsoft.Build.xsd (an empty file that pulls the other two schemas together)
Visual Studio's XML editor gives you intellisense by reading Microsoft.Build.xsd - find it under the Visual Studio installation root.
Identical schemas can be found in the .NET Framework install path - they're just installed under the VS root as well for the convenience of the XML editor.
To extend the schema, you'll want to create your own version of Microsoft.Build.xsd and point the XML editor at that (pull up the properties in the XML editor and choose your schema); or, just edit Microsoft.Build.xsd directly, following the instructions in there.
At some point, you'll ask yourself - why do I have to laboriously write XSD to match my custom tasks' parameters? Can't somebody just create an XSD fragment by reflecting over the task assembly? Well, you'd be right. Within the
MSBuild team, we used a simple tool internally to create schemas for the tasks we ship, but Peli has a better version here: <if anyone knows the URL it would be appreciated>
Why do I get lots of squiggles when I open Microsoft.Common.targets?
In Whidbey,
MSBuild requires every tag, including properties and items, be in the
MSBuild namespace. That means that even internal, temporary properties and items in the shipping targets files have to be in there too; but we didn't want them cluttering up the schema, so they appear invalid with respect to the shipping schema. In a future version,
MSBuild needs to support multiple namespaces, so all the targets stuff could go in a different namespace and not appear to be invalid.