0

I had a Visual Studio solution that was working fine. I did a fresh checkout from TFS (with both overwrite checkboxes selected) after deleting the entire source tree. Now C# 7.0 features are not building. Projects that do not build have been confirmed to have Target framework = .NET Framework 4.7.2.

Also, in the Advanced Build Settings, C# 7.0 options are not available (even though 7.0, 7.1, 7.2 and 7.3 are all available on my other machine which has not been wiped clean).

How do I fix this?

Environment: Visual Studio Enterprise 2017 Update 3, ReSharper 2018.1.3 (6/26/2018), C# 4.7.2

enter image description here

enter image description here

Community
  • 1
  • 1
dthal
  • 581
  • 1
  • 5
  • 16
  • Try changing var to object. – jdweng Jul 27 '18 at 17:52
  • 1
    Possible duplicate of [How to use c#7 with Visual Studio 2015?](https://stackoverflow.com/questions/39461407/how-to-use-c7-with-visual-studio-2015) – Jacob Krall Jul 27 '18 at 17:54
  • 2
    "Environment: Visual Studio Enterprise 2015" - that's the problem. I strongly suspect that your *working* machine has VS2017... – Jon Skeet Jul 27 '18 at 18:05
  • @jonskeet I had a typo in my original post. I am using VS2017. However, I mistakenly opened the project in VS2015. Good catch! That's gotta be it. – dthal Jul 27 '18 at 18:08
  • the linked answer was NOT the answer to my problem (i.e., I was not seeking to use C# 7 with VS2015 and its NuGet suggested answer was not applicable to my situation) – dthal Jul 30 '18 at 16:15
  • there is no warning if a VS2017 sln is accidentally opened in VS2015...the build errors are the first symptom – dthal Jul 30 '18 at 16:29

1 Answers1

1

The VS2017 solution was mistakenly opened in VS2015 (my dev environment requires both regularly). The solution was obviously to open it in VS2017.

@jonskeet provided the answer in a comment above

dthal
  • 581
  • 1
  • 5
  • 16