MVC 2 with VS 2010 View Building Error: the anonymous types function cannot be used because it is not part of the ISO-2 C # language specification

I have a collaborative project that stores all my own EditTemplates and DisplayTemplates. This is a typical C # class library project with views marked as embedded resources. The target structure of this project is ".Net Framework 4".

Inside / Views / folder, I included this web.config file to get MVC 2 intellisense when working with .aspx and .ascx files:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <httpHandlers>
      <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
    </httpHandlers>
    <pages
        validateRequest="false"
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc,     Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0,     Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <controls>
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral,   PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
      </controls>
    </pages>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />  
    <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode"    type="System.Web.HttpNotFoundHandler" />
    </handlers>
  </system.webServer>
</configuration>

Usually I have no problems with this setting, but once and while I get an error message when compiling my views:

Error 3 The function "anonymous types" cannot be used because it is not part of the ISO-2 language C # specification

, :

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>
<%
    string displayText = string.Empty;

    if (Model != null)
    {
        if (DateTime.Parse(Model.ToString()) != DateTime.MinValue)
            displayText = DateTime.Parse(Model.ToString()).ToShortDateString();
    }
%>

<%= Html.TextBox("", displayText, new { @class = "date-box" })%>

. , . , " " " 3", , ISO-2 # " ?

+3
4

- IDE 4.0 # , 2.0 . langversion.

csc/langversion: ISO-2...

: http://msdn.microsoft.com/en-us/library/f4ckecs0.aspx

, Asp.Net MVC, - , 2.0. , 2.0.

+4

, , App.Config . App.Config, .

+6

  • GUID

    ProjectTypeGuids: {E53F8FEA-EAE0-44A6-8774-FFD645390401}; {349c5851-65df-11da-9384-00065b846f21}; {fae04ec0-301f-11d3-bf4b-00c04f79efbc}

(This is a MVC3 project)

+2
source

For me, this was ultimately caused by low disk space, representing as a hail of unusual and inexplicable random build errors.

0
source

All Articles