Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tor Langlo 191 posts 554 karma points
    Nov 21, 2017 @ 17:24
    Tor Langlo
    0

    CSharp version 6

    Is it possible to configure an Umbraco 7 site to compile the templates/views using c# 6? If yes, how?

    What if the site is hosted on the Umbraco Cloud?

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Nov 22, 2017 @ 14:39
    Dan Diplo
    1

    Not sure on Cloud, but locally you can:

    Updated the Microsoft.Net.Compilers NuGet package to latest version.

    In your web.config add:

      <system.codedom>
        <compilers>
          <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:7 /nowarn:1659;1699;1701" />
        </compilers>
      </system.codedom>
    

    Change langversion to suit.

  • Tor Langlo 191 posts 554 karma points
    Nov 22, 2017 @ 18:39
    Tor Langlo
    0

    Thanks, Dan! I was aware of this, but uncertain if it will work on Umbraco Cloud. Anyone tried it?

  • Giacomo De Liberali 8 posts 78 karma points
    Feb 10, 2019 @ 13:24
    Giacomo De Liberali
    0

    Does it work in Cloud in the end or not?

  • Tor Langlo 191 posts 554 karma points
    Feb 10, 2019 @ 15:05
    Tor Langlo
    1

    This comes built in with the latest Umbraco version, so if you’re keeping up with the upgrades in Umbraco Cloud, then yes, it works!

    -Tor

Please Sign in or register to post replies

Write your reply to:

Draft