VS2015 new Web Project (c#6) with CS1617 Error resolution

Source: Internet
Author: User

VS2015 has added support for c#6.

In the new Web project template, by introducing NuGet package microsoft.codedom.providers.dotnetcompilerplatform:1.0.0 and adding in Web. config

  <system.codedom>    <compilers>      <compilerlanguage= "C#;cs;csharp"extension= ". cs"type= "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, version=1.0.0.0, Culture=neutral, publickeytoken= 31bf3856ad364e35 "WarningLevel= "4"compileroptions= "/langversion:6/nowarn:1659;1699;1701" />      <compilerlanguage= "Vb;vbs;visualbasic;vbscript"extension= ". vb"type= "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, version=1.0.0.0, Culture=neutral, publickeytoken= 31bf3856ad364e35 "WarningLevel= "4"compileroptions= "/langversion:14/nowarn:41008/define:_mytype=\&quot; web\&quot; /optioninfer+ " />    </compilers>  </system.codedom>

To provide c#6.0 support for razor (legacy projects can also be added for support)

But after you modify the target frame (for example, from 4.5 to 4.6), the site will not open and prompt

Server error in "/" application. Compile Error Description: An error occurred during compilation of the resource required to provide service to the request. Please check the following specific error details and modify the source code as appropriate.

Compiler Error Message: CS1617: Option "6" is invalid for/langversion; must be ISO-1, ISO-2, 3, 4, 5, or Default

SOURCE Error:

[No related source line]

source file: Line: 0


Show verbose compiler output:
C:\Program Files (x86) \iis express> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe"/t:library/ UTF8OUTPUT/R: "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP. Files\vs\ ... Microsoft (R) Visual C # Compiler version 4.6.0081.0for C # 5Copyright (c) Microsoft Corporation. All rights reserved. This compiler was provided as part of the Microsoft (R). NET Framework, and only supports language versions up to C # 5, WHI CH is no longer the latest version. For compilers this support newer versions of the C # programming language, see http://go.microsoft.com/fwlink/? Linkid=533240error CS1617: Option "6" is not valid for/langversion; must be ISO-1, ISO-2, 3, 4, 5, or Default

View the configuration in Web. config, found to have been automatically modified to (seems to be generally changed CS does not change VB, to lower the change will even VB together)

  <system.codedom>    <compilers>      <compilerlanguage= "C#;cs;csharp"extension= ". cs"type= "Microsoft.CSharp.CSharpCodeProvider, System, version=4.0.0.0, Culture=neutral, publickeytoken= b77a5c561934e089 "WarningLevel= "4"compileroptions= "/langversion:6/nowarn:1659;1699;1701">        <provideroptionname= "CompilerVersion"value= "v4.0"/>      </compiler>      <compilerlanguage= "Vb;vbs;visualbasic;vbscript"extension= ". vb"type= "Microsoft.VisualBasic.VBCodeProvider, System, version=4.0.0.0, Culture=neutral, publickeytoken= b77a5c561934e089 "WarningLevel= "4"compileroptions= "/langversion:14/nowarn:41008/define:_mytype=\&quot; web\&quot; /optioninfer+ ">          <provideroptionname= "CompilerVersion"value= "v4.0"/>      </compiler>    </compilers>  </system.codedom>

This is not working properly and needs to be manually modified to the original result

Suspect that this should be a bug in VS, who knows the feedback channel's help to mention it.

VS2015 new Web Project (c#6) with CS1617 Error resolution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.