Intellisense for Umbraco tags in your User Controls in Visual Studio

Wednesday, April 17, 2013 by David Conlisk

It's been bugging me for ages, and on my current project seemed especially annoying. When I try to place an Umbraco tag (e.g. umbraco:Macro or umbraco:Item) in my .NET user controls in my User Controls project in Visual Studio, they are not recognised as valid tags. This is what I get:

VS Intellisense Before

The fix is simple. Just add a web.config to your User Controls project (or update your existing one, if you have one), with the following content:

<?xml version="1.0"?>
          <add tagPrefix="umbraco" namespace="umbraco.presentation.templateControls" assembly="umbraco" />

Now you should have full intellisense for your Umbraco tags in your User Controls. Check it out - much better I think you'll agree:

VS Intellisense After

Thanks to @StephenWRogers for his input on this one.


If you found this article useful, please click the +1 button!


2 comment(s) for “Intellisense for Umbraco tags in your User Controls in Visual Studio”

  1. Gravatar of Stefan Kip

    Stefan Kip says:

    This is included in umbraco's web.config by default though...:
  1. Gravatar of David Conlisk

    David Conlisk says:

    Hi Stefan,

    Thanks for your feedback!

    Yes I copied the setting from the web.config in the Umbraco project, but this is for the setup where you have a separate User Controls project in Visual Studio. In that case you may not have a web.config at all in your User Controls project (as in my case), and VS doesn't recognise your Umbraco tags in that project. Adding this web.config to a project like that solves the problem. (Of course you'll also need a reference to umbraco.dll in that project, but I'm assuming you have this anyway when writing user controls for Umbraco!)



Please leave a comment: