Feature 'interpolated strings' is not available in C# 5. Please use language version 6 or greater

后端 未结 4 632
故里飘歌
故里飘歌 2020-12-15 05:02

There is a similar question to this here but I believe that involves a different cause.

I moved a class from a newer project into an older project. Both were targeti

相关标签:
4条回答
  • 2020-12-15 05:23

    I eventually found the place to change it. It seems sometimes when you update your targets framework version this does not get changed.

    0 讨论(0)
  • 2020-12-15 05:33

    Install DotNetCompilerPlatform version 2.1.0

    0 讨论(0)
  • 2020-12-15 05:36

    (It can applicable VS 2019 - .NET Framework 4.8 Web Application projects easily)

    I have realized this issue after install DotNetCompilerPlatform v3.6

    I have looked for TheColonel26's answer but I couldn't change selected language version:

    Appearantly, we can not change selected language version. (For details look here)

    After that I have used kfwbird's answer but with changes for newer version:

     <system.codedom>
         <compilers>
             <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
             <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
         </compilers>
     </system.codedom>
    

    Now it works as should be.

    0 讨论(0)
  • 2020-12-15 05:40

    Add this to your web.config. It is probably added automatically after installing DotNetCompilerPlatform.

    <system.codedom>
      <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
        <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
      </compilers>
    </system.codedom>
    
    0 讨论(0)
提交回复
热议问题