我是ASP.NET Core的新手.我试图了解project.json中的各种选项.但无法理解preserveCompilationContext的含义:在project.json中的构建选项下为true.根据微软
documentation
它描述如下:
preserveCompilationContext
Type: Boolean
true to preserve reference assemblies and other context data to allow for runtime compilation; otherwise,false
先感谢您
解决方法
据我所知,这主要用于Razor页面.它们在运行时编译,编译器需要访问引用程序集,以确保它正确编译.因此,要使用Razor页面,您需要设置preserveCompilationContext,然后包含已发布输出中的所有必需文件.
如果不需要运行时编译,则不必设置preserveCompilationContext.