Hello,
Part of my Unity code (mostly game logic) stays in the regular Unity VS project but I write my other Unity code (utilities, extensions, etc...) in regular VS DLL (assembly) projects. I import those DLLs into my Unity project manually.
Since I use references to UnityEngine in my VS DLL projects, your resharper plugin thinks that it is a Unity project and sets the default C# version to 4.0 which is very wrong for my case because I am happily able to use C# 6/7 version in those VS DLL projects.
Can I disable this "auto detect C# version" feature until you fix this bug?
Is there a settings/options window of this plugin somewhere (I couldn't finy) ?
I don't want to set every single VS DLL project to the correct C# version one by one manually (too many in my case).

Bump
If I understand the way the process of setting the C# language level works, the Unity plugins only will change something if the version is not already set in the project file. Therefore, the only reason this would happen is that you were relying on the default language level (and that language level was not set in the project file); this is considered bad form anyway (as someone else with a different version of VS may have a different default which breaks the project) and you should make sure that the correct language level is set.
Of course, I don't really have that much experience working with VS project settings directly, so I'm just making a slightly informed guess. I think your best solution in this case would be to write a quick script to set your target level in any necessary projects.
Thank you for your answer but this was just a bug report for Resharper plugin called "Unity support". I hope the notice and fix this soon.
@CAD97 is correct. The plugin will only override the language level if it's not already explicitly set in the project file. So you can add <LangVersion>5</LangVersion> to your .csproj file and the Unity plugin will respect that. If the language version isn't explicitly set in the project file, then Visual Studio, Rider and ReSharper all assume it's the latest C# version, and will suggest you use language features that won't compile.
The problem is that there's no reliable way of knowing when a project is being compiled by Unity's C#4 compiler, or when it's a project that references UnityEngine.dll and is being compiled externally by Visual Studio, so it's hard to automatically switch it off.
The way to override this behaviour is either to explicitly set the language level in the project files:
<PropertyGroup>
<LangVersion>6</LangVersion>
</PropertyGroup>
Or you can override the plugin's setting - the values in the .csproj.DotSettings file take precedence over the in-memory settings. You can edit the file and add this line:
…
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String>
…
You can see other values by setting the drop down and looking in the file.
My custom VS solution has lots of VS projects in it. Setting their language version manually and maintaining them in the future just to be able to use this Resharper plugin would be very uncomfortable. Setting the language version manually is very bad idea. The language version I always wanna use is the latest available one supported by the current VS installation. I have never seen people setting their language version manually in my software engineering life.
Maintaining examples:
There are very easy and reliable ways to check if the project belongs to(created by) Unity or not:
On the other hand, when I look at the language version of a Unity VS project, it shows as "Default". It looks like you don't even override the language version of a Unity VS project. So why override the language version of a NON-Unity VS project in the first place?
Can you please add a simple option to your plugin for disabling this language version detection system in the computer level? (Not solution or project level please)
If you don't have time for that, I can try to send you a pull request. Doable?
I tried setting the language version to 7.0 in the solution and computer level (by editting .sln.DotSettings and GlobalSettingsStorage.DotSettings files) but your plugin is still overriding the language level of individual non-Unity projects in the custom solution.
You need to edit .csproj.DotSettings - it won't look at the solution or global settings files. You'll need to set:
xml
…
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp70</s:String>
…
Or <LangVersion>7</LangVersion> in the .csproj itself.
When you say
when I look at the language version of a Unity VS project, it shows as "Default"
where are you looking for this value? I've tested this with projects that are VSTU projects and just standard C# projects, and the override works as expected in these cases.
You need to edit .csproj.DotSettings - it won't look at the solution or global settings files.
As I mentioned in my long answer about an hour ago, Setting it on many projects in a solution and maintaining them in the future is not cool and not an option.
Is it really hard for you to add an option to turn this behavior off in computer level?
where are you looking for this value?
I had to unsintall the plugin because it's not working for me but I will reinstall it and get you a screenshot.
Is it really hard for you to add an option to turn this behavior off in computer level?
Of course it's not hard. But I want to understand the problem and the impact before I make changes, especially when there are already two ways of overriding the behaviour, and this is the first time this has been asked for.
Here is the screenshot. You can clearly see that language level override feature is behaving in the opposite way.

If you want, we can schedule a screenshare and discussion session on google hangouts.
I really want to be able to use this plugin and I am interested in helping to improve it.
Oh, maybe I should say that, I have Visual Studio Tools for Unity extension. Maybe that extension is preventing you to override the language level on a Unity VS project.
That extension is essential for all Unity developers who are using Visual Studio. Doesn't matter if they have Resharper/Your plugin or not.
If that's the case, I think your plugin should not be conflicting with it. (Just guessing, no offense)
https://www.visualstudio.com/vs/game-development/#tab-4b0d0be8de5f65564ad
Additional check for presence of
<BaseDirectory>Assets</BaseDirectory>
in csproj seem like a good idea.

Language Level in the property grid doesn't seem to reflect the LanguageLevel in Re# settings. VS"15" on the screenshot.
Do you have "VS Tools for Unity" installed? That may be the reason.
Any update on this one?
@XtroTheArctic I have merged the fix https://github.com/JetBrains/resharper-unity/commit/118334a948577bddeb613a7be86b30acc9ddc0bf
Expect it in plugin build 1.9.0.
So the new behaviour is to override language level settings only if the project is to be compiled by Unity. If the project isn't intended to be compiled by Unity, you can use whatever compiler and language level you like. This is currently determined by:
Assets folder and references UnityEngine.dllAssets folder and is a VSTU project (technically, has the VSTU guid in the .csproj)But what should the behaviour be for a project that is a VSTU project, but doesn't have an Assets folder?
On the one hand, if it doesn't have an Assets folder, it's not going to be automatically compiled by Unity when the Unity Editor gets the focus. But on the other hand, it's explicitly a VSTU project - should the language level be overridden in this case?
Can you give me an example for the case that the project has VSTU but doesn't have Asset folder?
If it doesn't have Asset folder, it's NOT a Unity project. If it's not a Unity project, VSTU doesn't work (I guess).
Good point. I just assumed that VSTU would have an item in Visual Studio's new project dialog, but I should have checked. Looks like the only way to create a VSTU project is via generation in Unity (which would have the Assets folder).
I take it your projects are just simple class library projects? No VSTU support?
Yes, correct. My projects are pure class libraries. They have reference to UnityEngine but they don't have any assets. I build them manually and put into a Unity project. Unity imports them.
By doing this way, I am able to use latest C# version for my unity extension projects. I can also use PostSharp in Unity(via my manually built DLLs). Probably I am the only person who does that in the world :) :) I would like to know if I am not the only one :)
Sounds like the new logic is right then. Your class libraries will get the Unity helpers from Rider/ReSharper, but not the language overriding.
Hello. Sorry for commenting under a closed entry but...
It's been sometime and I still don't see 1.9.0 in Resharper extensions list. I don't see any info in milestone section either. Can you give me an ETA please?
Good point. We haven't updated the ReSharper plugin for a while, we've been concentrating a lot recently on Rider functionality. Let me do some testing and I'll get a new ReSharper plugin published.
Anytime soon?
Yes, sorry. Tomorrow!
Ugh. This is getting awkward. Tomorrow! (sorry)
OK, finally! I've published the missing 1.9.0 and 1.9.1 to the ReSharper Gallery.
Most of the work in those releases was aimed at Rider, sorry that ReSharper got ignored. The ReSharper specific fixes in these releases are:
Assets folderThere has been a lot more interesting functionality added for 2.0 (ShaderLab parsing!) but that needs some testing before release.