Unrecognized tag prefix or device filter 'sc' (in VS2012)

7.3k Views Asked by At

I can't get Visual Studio 2012 to recognize the 'sc' tagPrefix. My web.config contains the usual line:

<add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls"
     assembly="Sitecore.Kernel"/>

But I keep getting the Unrecognized tag prefix or device filter 'sc' message when I try to add a <sc /> tag to my page or user control.

If I open the same solution in Visual Studio 2010, it works fine.

Any ideas?

3

There are 3 best solutions below

2
On BEST ANSWER

I finally found it. The Web.Config that is provided by Sitecore contains the following section:

<pages validateRequest="false">
  <controls>
    <add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Kernel" />
    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Analytics" />
  </controls>
</pages>

For VS2012, you need to remove the asp tagprefixes, so the section ends up being:

<pages validateRequest="false">
  <controls>
    <add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Kernel" />
    <add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Analytics" />
  </controls>
</pages>

No idea why, but that solved the problem for me!

Little side note though: after this change, it won't work in VS2010 anymore.. (neither <sc: /> nor <asp: />)

1
On

if you have installed .net 4.5 it overrides the 4.0 and you would have other issues (depending on the specific sitecore version that you are running on...)

0
On

Add the below tag on top of the aspx file.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

Add below tags in web.config file

<pages>
    <controls>
        <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/>
    </controls>
</pages>

On the Tools menu, click Choose Toolbox Items. Add AjaxControlToolkit.dll files if you don't have them. Click Browse, then an Open dialog box appears. In the My Places Bar, select My Computer to browse for items installed on your computer.