How to use C# 6 with Web Site project type?

前端 未结 7 2144
说谎
说谎 2020-11-30 22:23

Updated an existing Web Site project type Visual Studio 2015, I changed the Framework to 4.6.

I then expected to have all those new features available in my

7条回答
  •  独厮守ぢ
    2020-11-30 22:47

    I've tested this with ASP.NET MVC 5 (tested 5.2.3), and your mileage may vary with other web frameworks, but you just need to add the Roslyn CodeDOM| NuGet package

    CodeDOM Providers for .NET Compiler...

    Replacement CodeDOM providers that use the new .NET Compiler Platform ("Roslyn") compiler as a service APIs. This provides support for new language features in systems using CodeDOM (e.g. ASP.NET runtime compilation) as well as improving the compilation performance of these systems.

    PM> Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
    

    https://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/

    The NuGet package should add the DLL files and add the following to your web.config.

      
        
          
          
        
      
    

    If it's still missing. Try adding yourself.

提交回复
热议问题