CS0246: The type or namespace name 'TemplateContainer' could not be found

R

robseflops

Hi!
I have a Asp.net 2.0 application that uses a masterpage. It works fine
on the development machine but when I move the app to a Win 2003 server
thinks go wrong: When I navigate to a page that uses the masterpage I
get the CS0246 error:

Compiler Error Message: CS0246: The type or namespace name
'TemplateContainer' could not be found (are you missing a using
directive or an assembly reference?)

Source Error:

Line 117: }
Line 118:
Line 119: [TemplateContainer(typeof(System.Web.UI.MasterPage))]
Line 120:
[TemplateInstanceAttribute(System.Web.UI.TemplateInstance.Single)]
Line 121: public virtual System.Web.UI.ITemplate
Template_ContentPlaceHolder1 {


Pages that don't use the masterpage work OK,
any ideas?

many thanks in advance
 
G

Guest

Check the web.config file. In the <system.web><pages></pages></system.web>
section, I had the following:

<pages
buffer="true"
enableSessionState="true"
enableViewState="true"
enableViewStateMac="true"
smartNavigation="false"
autoEventWireup="true"
pageBaseType="System.Web.UI.Page"
userControlBaseType="System.Web.UI.UserControl"
validateRequest="true"
masterPageFile=""
theme="CardinalHealthTheme"
styleSheetTheme=""
maxPageStateFieldLength="-1"
compilationMode="Always"
pageParserFilterType=""
viewStateEncryptionMode="Auto"
maintainScrollPositionOnPostBack="false"
asyncTimeout="45">
<namespaces>
<clear />
</namespaces>
<tagMapping>
<clear />
</tagMapping>
</pages>

It caused the same error that you reported. If you notice, I cleared the
namespaces and tagmappings. If you remove the <clear /> from the namespaces
section, it will build again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top