23

I have just created a new VM on Azure (using the image provided by the Azure team from the gallery) with CTP version of the upcoming Visual Studio 2014 that appeared yesterday online to test it and especially to play around with new C# 6.0 features.

However, it does not provide support for C# 6.0 out of the box, for none of the language extensions (primary constructors, property initializers, safe navigation operator) work there.

A blog entry on MSDN suggests adding the following to project settings:

 <LangVersion>Experimental</LangVersion>

But this changes nothing in my console project. Even the sample code from the second link doesn't compile at all.

safe navigation operator is not recognized

Do I miss something?

Lennart
  • 9,657
  • 16
  • 68
  • 84
Alexander Galkin
  • 12,086
  • 12
  • 63
  • 115
  • Do you have Roslyn installed? – abatishchev Jun 05 '14 at 18:24
  • http://msdn.microsoft.com/en-US/Roslyn – crashmstr Jun 05 '14 at 18:25
  • 7
    Do I need to install it separately? It should be now an integral part of Visual Studio and I see some new features leveraged by it (like refactorings). – Alexander Galkin Jun 05 '14 at 18:30
  • why do you have a space after the `()` ? The sample code you linked to doesn't do that. – Robert Levy Jun 05 '14 at 18:37
  • 1
    @RobertLevy I typed the code as it is, the space was added by the editor automatically without asking me, so I just left it as it is to show that the actual intent wasn't clear both to compiler and editor. – Alexander Galkin Jun 05 '14 at 18:38
  • Just a side note: _It is recommended to install the Visual Studio "14" CTP on a VM, VHD, or fresh computer. There are known side-by-side compatibility issues with Visual Studio 2013._ (cited [here](http://www.asp.net/vnext/overview/aspnet-vnext/getting-started-with-aspnet-vnext-and-visual-studio)) – Brad Christie Jun 05 '14 at 18:53
  • 1
    @BradChristie Actually I just used the image provided by Azure to create a brand new VM with only VS2014CTP installed there, there is no any other side-by-side software whatsoever and it is running in the VM hosted on Azure. I will edit my question to add this detail, if this might be important here. – Alexander Galkin Jun 05 '14 at 18:56
  • 2
    Try using "experimental" with a lower case 'e'. We had a bug where we compared case sensitively, and may not have got the fix checked in early enough to reach the CTP. – Kevin Pilch Jun 05 '14 at 20:51

1 Answers1

26

There is a bug in the CTP where the LangVersion switch is case sensitive. Try using experimental instead.

Kevin Pilch
  • 11,485
  • 1
  • 39
  • 41
  • 1
    I confirm that it works for me, the original blog page has been updated to reflect this change too. I suggest you add the warning that this setting is case-sensitive to your blog entry too. – Alexander Galkin Jun 05 '14 at 21:28
  • This option no longer works in Visual Studio 2015 preview - Invalid option 'experimental' for /langversion. – Ilya Suzdalnitski Mar 15 '15 at 17:03
  • It's no longer required in VS 2015. There are no longer any "experimental" features included in the compiler that is part of VS 2015. – Kevin Pilch Mar 16 '15 at 18:06