Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

C# 6 not supported yet?

gambyte.work's Avatar

gambyte.work

17 Dec, 2016 10:59 PM

Hey,
Im getting an error while building my project:
error CS1056: Unexpected character '$'
which is probably because c# 6 is not supported...
Ive seen in the forums that you can use c# 6 when adding the compiler libraries from nuget (?)

But shouldnt it supposed to be supported now? and im not sure how to apply it...

  1. Support Staff 1 Posted by rune on 19 Dec, 2016 08:21 PM

    rune's Avatar

    Hi,

    This is actually an issue related to using C# 6.0 without specifying the Roslyn compiler required for it. This is usually not an issue while developing locally as VS2015 and later uses the Roslyn compiler to build applications by default, and it's likely to also explain the difference between your local environment and AppHarbor's. However, if you try and run your application locally in IIS you'll likely experience the same issue you're seeing on AppHarbor as Visual Studio won't be doing it's "magic" to make the application work without the configuration required to enable C# 6.0.

    In any case, it sounds like you're on the right track and know about some of these issues from the forums: If you want to use C# 6.0 features such as the string interpolation that currently returns an error you should be able to do so by installing the Microsoft.CodeDom.Providers.DotNetCompilerPlatform NuGet package (and the Microsoft.Net.Compilers dependency). Here's an example app that uses these packages to support C# 6.0 features. Note that installing these packages will also add the necessary C# 6.0 compiler configuration to your project, so make sure to save the project and solution, and commit the changes to your repository before pushing to AppHarbor again.

    I hope this helps, but let me know if you're still experiencing issues with this after installing the packages mentioned above.

    Best,
    Rune

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac