The Friendly Coder

On software development and technology

MSBuild: Visual Studio Intellisense

Visual Studio has shipped with built-in Intellisense support for MSBuild for several years, however anyone who has used either of the two commonly used add-on packs (the Community Tasks and the Extension Pack) has undoubtedly noticed that these custom tasks are not natively supported. Further, anyone who has gone digging will notice that these projects either explicitly do not support intellisense or simply do not make it obvious how to set it up. As such I have taken the liberty of doing the leg work needed to get these working and decided to make my findings public on todays post.

Step 1: Support Files

To start off you will need the following set of Visual Studio support files:

I assembled these files from numerous sources including the Extension Pack online code repository and a sample schema definition I found from Google Code for the community tasks. The latter required some refactoring to fix several compatibility problems with Visual Studio.

Just unzip them into the Visual Studio schema definition folder [Visual Studio Install Path]\Xml\Schemas\1033\MSBuild. For example, for Visual Studio 2010, the default folder location is:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas\1033\MSBuild.

Step 2: Configure Visual Studio

Visual Studio uses the schema definition files stored in this folder for configuring it’s Intellisense subsystem. By default, the primary entry point for MSBuild projects is the following file:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas\1033\Microsoft.MSBuild.xsd

This file, in it’s default configuration, doesn’t contain much. If you open it in your favorite text editor, you will basically see just a single functional statement that looks like this:

    <xs:include schemaLocation="MSBuild\Microsoft.Build.CommonTypes.xsd"/>

This statement imports all the standard MSBuild definitions used by the IDE. So, to enable support for these new tasks you just need to add one new include statement for each schema file you want to enable like this:

<xs:include schemaLocation="MSBuild\MSBuild.ExtensionPack.Framework.xsd" />
<xs:include schemaLocation="MSBuild\MSBuild.Community.Tasks.xsd" />

TIP: You may need administrator privileges to modify this file. This can be done by launching your text editor using the “Run as administrator” context menu when right-clicking its shortcut.

Step 3: Test Installation

Launch your Visual Studio IDE and either create a new MSBuild script or open an existing one. If something goes wrong and the schema definition can not be loaded, you will likely end up with a context menu that looks something like this:

Example screenshot of broken Intellisense

If you end up in this situation, one of several things is likely to have happened.

  • Perhaps you have a typo in your microsoft.msbuild.xsd file
  • Maybe your version of Visual Studio is not compatible with these schemas. If so please drop me an email and let me know what version you are using and I will try to fix the schemas.
  • You may be encountering one or more of the bugs described below in the Known Limitations section, some of which are caused by problems with Visual Studio and therefore there may not be much you can do about it.

Known Limitations

  • Currently I have only fixed the schema definition files for the framework module of the Extension Pack add-on. The other modules (TFS, Virtualization, SQL, etc.) have not yet been fixed.
  • I am not certain which version of the add-ons are documented by these schema definitions and I have not made efforts to synchronize them with the latest features of the add-ons. As such, some of the task descriptions may not be correct.
  • Due to the most recent changes in the MSBuild task base class API, some of the custom tasks documented here have conflicting attributes with the current API. Most notably, there is now a common “Label” attribute on the base class that conflicts with the “Label” attribute of some of the derived tasks. Such conflicting parameters are not supported by the schema definition format. To address this I renamed the derived attributes to include an underscore prefix (ie: “_Label”)
  • Due to a bug with Visual Studio intellisense (as described here), some features may not function correctly if you use custom-defined tasks that have no declaration in the active schema. To resolve this issue you can simply add a dummy declaration for any such custom tasks to the Microsoft.MSBuild.xsd file. For a quick overview of how this is done, see this blog article

What’s Next?

I hope you found this post helpful – if so, drop me a comment below. If you find any bugs or problems with the content of the tutorial, again, just drop me a comment describing your findings. If, on the other hand, you have taken the time to enhance or fix any part of the attached schema definitions I would appreciate a ping-back with an explanation of what you have done. Feel free to send me a copy of your fixes and I’ll update my attachment accordingly so we can all share your work.

2 Responses to “MSBuild: Visual Studio Intellisense”


  1. SteveC

    Thanks for posting … shame, can’t seem to get it to work in VS 2010

  2. Yeah – Microsoft seems to make changes to their schema’s over time so it’s hard to keep these working.

Leave a Reply