【发布时间】:2018-07-01 08:04:54
【问题描述】:
Azure 函数应用引用了一个 webApi 项目,该项目使用 razorEngine 构建 cshtml 视图。
问题在于访问 cshtml 文件。直到现在我还在使用:
HostingEnvironment.MapPath("~/Views/templates/") + "test.cshtml";
访问曾经作为独立项目使用 webApi 的文件。现在作为一个引用的程序集,路径评估为
E:\Web\Proj.Func\bin\Debug\net461\test.cshtml
评估结果不是cshtml 文件的正确路径。
如何解决?
【问题讨论】:
-
文件“test.cshtml”是否被复制到Debug文件夹中?
-
调试文件夹不包含
test.cshtml -
尝试在 Visual Studio 的 test.cshtml 文件的属性中将 copyAlways 属性设置为 true,看看是否有帮助?
-
没有,试过了。实际上引用的程序集只是一个 DLL。
-
也许你应该尝试嵌入你的cshtml。
标签: c# azure asp.net-web-api azure-functions