1

I have a web project targeting .NET Framework 4.5.1 that has working code using 'null propagating operator' in an .aspx code behind file.

However, when I using a 'null propagating operator' in an IHttpHandler living inside my App_Code folder, it throws the error:

"Feature 'null propagating operator' is not available in C# 5. Please use language version 6 or greater."

This is the same project, and in properties > build > advanced: I am targeting C# 6.

Shown here: WordpressContactFormHandler.cs errors with C# 6 features, but Default.aspx.cs does not.

solution explorer

Here you can see it errors trying to use null propagation in the class.

code sample

Evan Morrison
  • 652
  • 6
  • 18
  • 1
    Possible duplicate of [How to use C# 6 with Web Site project type?](http://stackoverflow.com/questions/31548699/how-to-use-c-sharp-6-with-web-site-project-type) – Uwe Keim May 23 '16 at 18:06
  • You should differ the version of the Framework and the version of the C#. You simply must change the project type and port your app. – VMAtm May 27 '16 at 12:34
  • This is not a duplicate @UweKeim as I am already successfully targeting C# 6 in my code behind files in other areas of the same project. This only errors in my IHttpHandler. --- VMAtm I do not understand what you're saying. The version of the Framework is .NET 4.5.1 and C# is version 6 (those are different?). I don't want to port my app? – Evan Morrison Jun 01 '16 at 18:52

0 Answers0