1

I'm trying to use VB 15.0 in an ASP.NET website project, but when I try to set the language version to 15.0, I get the following error:

BC2014: the value '15.0' is invalid for option 'langversion'

And if I set it to latest, I get this error:

BC2014: the value 'latest' is invalid for option 'langversion'

I'm "setting the language version" by changing the /langversion: section of the line

<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />

of my Web.config to /langversion:15.0 or /langversion:latest.


So far I have tried ensuring my Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers NuGet packages are up to date as explained in the answers to this question.

I can't seem to find anything similar to this problem. What should I do?

Edit: /langversion:default results in that same error, and so does /langversion:13. Values 12 and below, however, do work.

NetherGranite
  • 1,940
  • 1
  • 14
  • 42
  • @AndrewMorton That results in the same error, but I also just discovered that `/langversion:13` also results in that error. – NetherGranite Jul 29 '19 at 16:27
  • @AndrewMorton Oh that's probably good information to have; I'm using VS2017. – NetherGranite Jul 29 '19 at 16:37
  • @AndrewMorton Closing the web.config didn't seem to do anything, and the project is set to .NET 4.7.2 at the moment. – NetherGranite Jul 29 '19 at 16:52
  • If you go to "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn" (adjust as required), open a command prompt, and run `vbc.exe -langversion:?` does it show several versions, including the ones you want to use? E.g. I get `default, 9, 10, 11, 12, 14, 15 (default), 15.3, 15.5 (latest), latest`. – Andrew Morton Jul 29 '19 at 17:09

0 Answers0