Strange error

Topics: General
Nov 28, 2011 at 8:00 PM

i sometimes got this error:

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: 'string' does not contain a definition for 'CamelFriendly' and no extension method 'CamelFriendly' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)

Source Error:

 
Line 2:      <fieldset>
Line 3:          @*<label for="@Html.FieldIdFor(m=>m.Value)">@Model.Name</label>*@
Line 4:          <label for="@Html.FieldIdFor(m=>m.Value)">@T(Model.Name.CamelFriendly())</label>
Line 5:          @Html.EditorFor(m=>m.Value)@Html.ValidationMessageFor(m=>m.Value)
Line 6:      </fieldset>

after i rerun the vs, it is ok automatically.

it is very strange to me, although i think maybe it is the issue of Rasor .

Nov 28, 2011 at 10:18 PM

maybe  lack of namespace

Coordinator
Nov 28, 2011 at 10:22 PM

That's an extension method. You need the assembly where it is defined to ba referenced, and you need a using statement bringing into scope.