ASP.NET Core App project.json build选项下的preserveCompilationContext有什么用?

What is the use of preserveCompilationContext under build option in project.json in ASP.NET Core App?

我是 ASP.NET Core 的新手。我试图了解 project.json 中的各种选项。但是无法理解 project.json 中构建选项下的 preserveCompilationContext: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