开发者

Optional and named parameters, language specification in MVC2

I'm using MVC2 in a mixed webforms project, my Model classes compile fine with optional and named parameters, but my view won't compile when using th开发者_高级运维em. I get:

Error 38 Feature 'named argument' cannot be used because it is not part of the 3.0 C# language specification

Any ideas? Thanks


Your app will need to be configured to run in ASP.NET 4.x rather than 2.x; you might also want (in your web.config):

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v4.0" />
        <providerOption name="WarnAsError" value="false" />
      </compiler>
    </compilers>
  </system.codedom>

You might get away without this if you pre-compile your views.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜