Compiler Error Message: CS1061..... on "Topic" page(s)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hi all,

Been working away at customizing a theme/layout on a project (v2.2) and suddenly see this error on Topic pages (AboutUs page specifically) now...

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper<Nop.Web.Models.Topics.TopicModel>' does not contain a definition for 'AddTitleParts' and no extension method 'AddTitleParts' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<Nop.Web.Models.Topics.TopicModel>' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 15:     if (!Model.IsPasswordProtected)
Line 16:     {
Line 17:         Html.AddTitleParts(!String.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Title);
Line 18:         Html.AddMetaDescriptionParts(Model.MetaDescription);
Line 19:         Html.AddMetaKeywordParts(Model.MetaKeywords);


Source File: c:\websites\hostnca1\domain.com\wwwroot\Themes\DarkOrange\Views\Topic\TopicDetails.cshtml    Line: 17

What did we do wrong? Can anyone help with this (note, I am not a developer).  

nopCanuck
12 years ago
nopCanuck wrote:
Hi all,

Been working away at customizing a theme/layout on a project (v2.2) and suddenly see this error on Topic pages (AboutUs page specifically) now...

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper<Nop.Web.Models.Topics.TopicModel>' does not contain a definition for 'AddTitleParts' and no extension method 'AddTitleParts' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<Nop.Web.Models.Topics.TopicModel>' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 15:     if (!Model.IsPasswordProtected)
Line 16:     {
Line 17:         Html.AddTitleParts(!String.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Title);
Line 18:         Html.AddMetaDescriptionParts(Model.MetaDescription);
Line 19:         Html.AddMetaKeywordParts(Model.MetaKeywords);


Source File: c:\websites\hostnca1\domain.com\wwwroot\Themes\DarkOrange\Views\Topic\TopicDetails.cshtml    Line: 17

What did we do wrong? Can anyone help with this (note, I am not a developer).  

nopCanuck


You're not doing anything wrong nopCanuck. You copied the file from the main view section and placed it within the custom theme folder.

If you look in the main view section and review the web.config you will find this section of xml:


  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="Nop.Web.Framework.ViewEngines.Razor.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="Nop.Web.Framework.UI" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>


I believe you will need that same section inside of your custom theme views web.config. Alternatively, you will need to add @using Nop.Web.Framework.UI; to the top of every view experiencing this error.
12 years ago
Thanks! That pointed us in the right direction.

nopCanuck
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.