【发布时间】:2013-03-02 08:50:25
【问题描述】:
我有一个返回文件内容的类库项目(NotificationTemplate):
public static class Template
{
public static string NotificatioEmail
{
get { return File.ReadAllText("Templates\\NotificatioEmail.cshtml"); }
}
}
在这个项目中,文件夹 Templates 和 NotificatioEmail.cshtml 文件。
另外,我有两个应用程序:控制台应用程序和 ASP.NET MVC 应用程序。该文件在控制台应用程序中返回正常,但在 MVC 中我收到错误file not found。怎么写万能?
我试过这个:
Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Templates",
"NotificatioEmail.cshtml")
但BaseDirectory 不包括bin 文件夹。
【问题讨论】:
标签: c# asp.net-mvc class-library