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

纵然是瞬间 提交于 2019-12-03 20:19:03

Somehow your IDE experience is causing the 4.0 C# compiler to be limited to features allowed in the 2.0 version of the compiler. This can be done using the langversion switch. For example

csc /langversion:ISO-2 ...

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

I'm unfamiliar with how compilation works for Asp.Net MVC but somewhere in your project system you've asked to be limited to the 2.0 framework. My first guess would be to look at the project page of the project and make sure it's not targeting 2.0.

I've faced with this issue, and have spent a lot of time, while figured out that App.Config file with empty configuration section in it was root of the evil. Simply remove App.Config, and all will work fine.

The solution for me was to change the project type

  1. Unload the project
  2. Edit project
  3. Swap the project GUID for this

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

(This is an MVC3 project)

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!