38

I have been working at my current company for a little over six months and we're currently using Visual Studio 2012. We are going to start building a new application and I've been trying to get a commitment to a Visual Studio 2015 upgrade so that we can start with the latest technology. Unfortunately it's a small company and there are budgets to consider.

Does anyone know if C# 6.0 will be supported in Visual studio 2012. I'm thinking that, since it's about to become 3rd generation old it may not get support.

UPDATE:

I saw a lot of comments related to the community edition of VS2015 so I thought I would clarify my company's position regarding that version. The company has around 20 employees and a 6 person IT team who all need VS for various reasons. We also have over $1M sales so we can not qualify for community edition.

UPDATE 2:

Q: Is there some specific feature in C# 6.0 you can't live without?

A: Not any particular feature although property initializers and primary constructors will cut down on a lot of chaff in code.

Raktim Biswas
  • 4,011
  • 5
  • 27
  • 32
Roland Schaer
  • 1,656
  • 1
  • 22
  • 30
  • 1
    It will not get support for new language features. Visual Studio 2015 uses Roslyn compiler instead of old native compiler and all the new features are only implemented in Roslyn. – MarcinJuraszek Feb 20 '15 at 21:32
  • VS 2013 doesnt even support C# 6.0, you'll need VS2015. You need the latest compiler to support this – Sievajet Feb 20 '15 at 21:32
  • 1
    @Roland Schaer There is a new community edition. If your employer is small enogh ( less than 1M $ a year ) you can use this one for free. It includes - as opposed to the old Express versinos - plugins and is comparable to the professional version. – Sascha Feb 20 '15 at 21:33
  • I looked into the community edition and unfortunately our yearly sales are over 1M $. – Roland Schaer Feb 21 '15 at 16:32
  • important about primary constructors: https://stackoverflow.com/questions/26915789/primary-constructors-no-longer-compile-in-vs2015 – Vinicius Gonçalves Jul 19 '17 at 11:35

3 Answers3

58

Yes, you can install c# 6.0 into VS2012 and VS2013 on a per project basis as a NuGet package. You'll have to install this package for every project that you want c# 6.0 features in.

https://www.nuget.org/packages/Microsoft.Net.Compilers/

Installing Latest C# Compiler via Nuget

Install-Package Microsoft.Net.Compilers

EDIT: As pointed out in the comments below, upgrade your NuGet to the latest version in order to ensure full compatibility with the nuspec file.

Community
  • 1
  • 1
Alex
  • 855
  • 7
  • 11
  • 1
    Can you elaborate on this? After installing Microsoft.Net.Compilers with NuGet, how should I proceed? – Diabeteman Oct 20 '15 at 23:29
  • 3
    After you've installed that NuGet package in your project you can start using C# 6.0 features in that project. For example add an expression bodied method like: public int GetValue() => 10 * 10; If you use the latest ReSharper, you will get red squiggly lines under that method. The light bulb icon that appears next to it will have an option to Enable C# 6.0 Features. – Alex Oct 22 '15 at 12:10
  • 1
    This worked great for our on-premise **TFS 2012 Build Controller**! Great find. – SliverNinja - MSFT Jan 21 '16 at 23:07
  • 1
    My code compiles fine. I don't have Resharper. VS2012 shows c# 6.0 code as error. How do I fix this? Please help. – Mathew Sachin Feb 18 '16 at 04:01
  • 4
    @MathewSachin: there is no way to avoid red squiggly lines in VS2012/2013 for new C# 6 features, even if they compile fine. It is the VS2012/2013 **editor** that doesn't understand the new syntax and shows errors, see a [Social MSDN post regarding VS2013](https://social.msdn.microsoft.com/Forums/en-US/2974e998-e383-47e4-b030-2117e58c38e6/can-i-use-c6-language-features-with-visual-studio-2013?forum=csharpgeneral) – Fulvio Feb 18 '16 at 10:09
  • 1
    If you have an older version of VS2012, make sure you upgrade NuGet first or the older one probably will not parse the nuspec correctly. – kenchilada Apr 29 '16 at 12:51
4

Q: Does anyone know if C# 6.0 will be supported in Visual studio 2012.

A: No, absolutely not. For both technical and marketing reasons.

C# 6.0 is the latest/greatest/bleeding edge version of C# which will ship with VS 2015.

If you wish to use MSVS 2012, then you must write to C# 5.0 or lower. With assurances your code should be portable when you upgrade your compiler.

Q: Is there some specific feature in C# 6.0 you can't live without?

FoggyDay
  • 11,962
  • 4
  • 34
  • 48
-2

You'll have to upgrade. You'll want to as well as the IDE gets changes that help with development and the new features.

You might consider Visual Studio Community (formerly VS Professional). When they release VS2015 I'd expect a release similar to VS 2012 Community.

See here for more information. Up to 5 devs can get a copy in a commercial company.

mlw4428
  • 510
  • 1
  • 6
  • 21
  • 1
    Note that the 5 users in a commercial company license applies to "non-Enterprise" companies. An Enterprise company is defined as one with > 250 PCs or > $1 Million US Dollars in annual revenue (see first question in the Q&A section of the page linked to above) – Frank Boyne Feb 20 '15 at 21:50
  • @FrankBoyne In his question he did say he was in a small business. If the company has over 250 PCs or $1,000,000 in annual revenue they can afford the licenses. – mlw4428 Feb 20 '15 at 22:33