Error: Unknown server tag 'uc1:SomeControl'
When compiling an ASP.NET project using Visual Studio 2010, the build fails with:
Unknown server tag 'uc1:SomeControl'
where the name "uc1:SomeControl" may vary, but is a user control which is part of the project.
Possible Causes and Remedies
- The most likely cause is that there are other compiler errors
and that the control itself has failed to compile.
Look at the "Output" tab (rather than the "Error List" in Visual Studio) and if this is not the first error listed then address any preceeding errors first.
- The Register directive is wrong.
Near the top of the .aspx file there should be a line like this:
<%@ Register Src="..." TagName="SomeControl" TagPrefix="uc1" %>
Check that this line is present, and that the "Src" part correctly points to the source of the control.
- Disable batch build
Ideally for performance you want to leave batch building enabled, but see if this resolves the error for you.
Edit the web.config file, and add
batch="false"to the complation tag. So your web.config file should look something like:
<?xml version="1.0" encoding="utf-8"?>
<compilation debug="true" batch="false">
At the very least this may reveal the underlying issue when you compile.
These notes have been tested within Microsoft Visual Studio 2010 Professional, running under Windows 8 Professional and may apply to other versions as well.
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.