我收到了这个构建错误:
Compiler Error Message: CS1061: 'Timesheet.Models.Time' does not contain a definition for 'Hours' and no extension method 'Hours' accepting a first argument of type 'Timesheet.Models.Time' could be found (are you missing a using directive or an assembly reference?)
...
Line 36: <td class="text-right">@String.Format("{0:N2}", client.Projects.SelectMany(project => project.Times).Sum(time => time.Hours))</td>
尽管在模型中有这个:
public Decimal Hours
{
get
{
return Convert.ToDecimal(Convert.ToDateTime(Minutes).TotalHours);
}
}
基本上,我刚刚更换了一个Start&amp;使用“分钟”字段结束时间,并更新“小时”定义以使用“分钟”而不是“开始”和“开始”计算。结束时间(并将其从HoursSpent重命名为Little Hours)。但是模型中的这些变化并没有正确地“建立”。
事实上,如果我检查模型第36行的智能感知,我会看到旧字段。如果我在HoursSpent上点击F12,则需要“Time [from metadata]”,而不是Time模型。所以构建没有建立。
答案 0 :(得分:0)
我认为问题是我从本地IIS打开了这个项目,而且有些麻烦。我重新启动并从文件系统重新打开,这似乎解决了问题。