Problems with user controls while publishing web apps

I recently had a major issue while publishing a web app that consisted of a lot of User Controls. Every time I opened a page that contained a user control I got the following error:

The base class includes the field ‘TestUserControl1’, but its type (TestUserControl) is not compatible with the type of control (ASP.TestUserControl_ascx).

I noticed that my code was running perfectly fine when I was running it through Visual Studio, but as soon as I published this error would show up on the published website. After cursing and swearing for a while, I tried to publish it with no extended publish options. And viola the error was gone. Intrigued by this I tried to recreate the error and noticed that the ‘updatable’ option while publishing was the cause of the problem.

So the fix: Uncheck the “Allow this precompiled site to be updatable” and publish the site again.

However, the reason behind this error can be many. So I would suggest you google a bit. There are many forums with annoying amounts of discussion on this. I read several posts on this and spent about an hour googling when I came across this article on Microsoft Support web site which may also be helpful: