RazorEngine 和 Visual Studio 2015 IntelliSense

RazorEngine and Visual Studio 2015 IntelliSense

这个 post 与 ASP.NET MVC 无关。

我正在使用 RazorEngine 进行模板处理,此处提供:

https://antaris.github.io/RazorEngine/

文档指出,如果我按照以下说明操作,我可以使用 IntelliSense:

https://antaris.github.io/RazorEngine/IntellisenseAndResharper.html

但是,VS 显示如下错误:

The type or namespace name 'RazorEngine' could not be found (are you missing a using directive or an assembly reference?)

还有以下错误:

The type or namespace name 'Linq' does not exist in the namespace 'System'
The type or namespace name 'Helpers' does not exist in the namespace 'System.Web'
The type or namespace name 'WebPages' does not exist in the namespace 'System.Web'
The type or namespace name 'WebPages' does not exist in the namespace 'System.Web'
The type or namespace name 'WebPages' does not exist in the namespace 'System.Web'

我收到错误是因为我正在命令行项目中编辑 .cshtml,其中指令假定我使用 Web 项目吗?这没有意义,因为 RazorEngine 没有任何项目类型要求。

我该如何解决这个问题?如何使用 IntelliSense 在命令行项目中编辑 .cshtml 文件而不出现上述所有错误?


找到答案

RTFM

根据网页:

您的项目输出路径设置为 bin\ 而不是 bin\Debug\ 和 bin\Release。 另一种可能的解决方案是将 RazorEngine.dll 和 System.Web.Razor.dll 复制到 bin。

我不会删除 post 因为它可能对其他人有帮助。

找到答案

RTFM

根据网页:

您的项目输出路径设置为 bin\ 而不是 bin\Debug\ 和 bin\Release。另一种可能的解决方案是将 RazorEngine.dll 和 System.Web.Razor.dll 复制到 bin.