如何设置 Visual Studio 以在 (Umbraco) 项目中创建 CSHTML 文件

问题描述:

所以,我正在 Visual Studio 中为我的 Umbraco 项目开发我的 razor 宏脚本.一切正常,但有两件事真的很烦人.

So, i'm developing my razor macroscripts in Visual studio for my Umbraco project. Everything is working fine, but there are two things really annoying.

  • 如果我想创建一个新的 CSHTML 文件,最好的解决方案是复制现有文件.
  • 我没有完整的剃须刀智能感知,例如Html.Raw

有没有办法配置我的项目以使用此功能?还没有找到 .cshtml 模板.

Is there a way to configure my project to use this features? Didn't find a .cshtml template yet.

您需要安装 MVC 框架,然后当您将项目作为网站打开时,您应该能够创建和编辑带有语法突出显示的 cshtml 文件.有关详细信息,请参阅我对以下帖子的回答:

You need to have the MVC Framework installed, then when you open the project as a website, you should be able to create and edit cshtml files with syntax highlighting. See my answer to the following post for more details:

为 Umbraco 设置本地开发环境