140

While using ReSharper, it suggested "Enable C# 6.0 support for this project". I foolishly clicked on it, and now as advertised it's giving me suggestions for C# 6.0 - which then give me errors as I am not using C# 6.0 in this project.

How can I disable C# 6.0 support, returning it to how it was before? (Preferably without having to individually ignore specific suggestions)

1
  • 1
    This just happened to me but I don't recall seeing that suggestion. I was creating a new class in my project, implementing an interface and it was suggesting c# 6 stuff. I was so confused.... Jun 12, 2015 at 15:13

2 Answers 2

165

Click the project node in the Solution Explorer. Then look in the Property Grid (F4). You'll see a property named "C# Language Level". Set that to "Default" or your desired language level.

enter image description here

10
  • This is not available in VS2015 Preview, any alternatives? Mar 16, 2015 at 15:25
  • 13
    It is available under Project => Properties => Build => Advanced. Mar 26, 2015 at 5:18
  • 1
    It is available in 2015 RC, on projects, not on the solution.
    – Fontanka16
    Jun 1, 2015 at 20:42
  • 4
    @MDeSchaepmeester just multi select all projects to set Language Level once for the whole solution. Each project wil get it's own .DotSettings file
    – Jochen
    Jul 27, 2015 at 15:38
  • 1
    FYI - Selecting "Default" in VS2015 RTM will still leave C# 6.0 enabled (that's apparently the default in VS2015) -- you need to explicitly select C# 5.0 if that's what you want.
    – Mr. T
    Sep 8, 2015 at 18:18
59

TO disable it at once across the solution rather than per project level, please add below in .sln.DotSettings

<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String>

it would disable resharper 6.0 features/give you error

EDIT

as per comments, in case you dont have the sln.DotSettings file at all, then you need to create one with below contents

<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> 
    <s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">‌​CSharp50</s:String>
</wpf:ResourceDictionary>
11
  • 12
    This should be marked as the answer, it solves the problem at solution level, i.e. without the need to set per csproj property
    – aateeque
    Nov 2, 2015 at 18:23
  • 2
    Here is the entire content of sln .DotSettings file, in case you need to recreate it like i did. <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String></wpf:ResourceDictionary> Nov 5, 2015 at 10:44
  • 1
    @JesonMartajaya updated answer to include your comments
    – harishr
    Nov 6, 2015 at 3:08
  • 1
    This works for me. Heads-up though: that first XML snippet has an unmatched </wpf:ResourceDictionary> tag at the end.
    – Nick Smith
    Nov 30, 2015 at 20:12
  • 3
    Updated: I was tearing my hair out trying to figure out why this wasn't working. Turns out I had changed the language setting in the project properties, which creates a .csproj.DotSettings file. When I changed the setting back to "Default" from "CSharp50," the "Default" in the project-specific settings was overriding the solution-wide "CSharp50" setting. Removing the .csproj.DotSettings file and re-opening the solution fixed it.
    – Nick Smith
    Dec 14, 2015 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.