Error Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default

送分小仙女□ 提交于 2019-11-28 18:04:50
DrewB

Pay attention to compiler "type" in the Web.Config file, when changing Framework version:

for 4.5 and C#5 -

type="Microsoft.CSharp.CSharpCodeProvider...

for 4.6 and C#6 -

type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

More info in this forum post

Developer

Update the following NuGet packages (whichever installed) to resolve the problem:

  • Microsoft.CodeDom.Providers.DotNetCompilerPlatform
  • Microsoft.Net.Compilers

1.Go to Project and select your Project properties.

2 Select Build and Click Advanced Button.

3.Select Language Version default.

4.Save .

https://youtu.be/IP8feQeWqkk

I met such behavior if project was not fully upgraded to VS2015. In case if you open solution from 2015 in VS2013 - you will get this error

PBo

See an answer to ASP.NET strange compilation error!.

Downgrading your C# language to 5 only masks the problem, as soon as someone uses a C# 6 feature your website/project will break and you will still spend time fixing it again. Try the solution in the link.

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