Compiler Error Message: CS1617: Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 o

时间:2021-06-02 16:12:18

 CS1617: Invalid option '6' for /langversion;解决办法

报错图片:

Compiler Error Message: CS1617: Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 o

解决:

<system.codedom>
    <compilers>
      <compiler language="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">
        <providerOption name="CompilerVersion" value="v4.0"/>
      </compiler>
      <compiler language="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+">
          <providerOption name="CompilerVersion" value="v4.0"/>
      </compiler>
    </compilers>
  </system.codedom>

在web.config将这段节点注释了,它是自动加的,就是在修改.NET Framework的时候自动加的,将其注释就好了。

Compiler Error Message: CS1617: Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 o