2014-01-17 35 views
0

在我的.cshtml文件,我得到一個錯誤的地方我用@ Html.TextBoxForEmbeddedResourceVirtualPathProvider和@ Html.TextBoxFor(LINQ表達式)

這裏是一個示例代碼:

@model WebComposite.Models.CompositeModel 

<label for="name">Name</label> 
@Html.TextBoxFor(m => m.name) 

錯誤:

Error #1: 
'System.Web.Mvc.Html.InputExtensions.TextBoxFor<TModel,TProperty>(System.Web.Mvc.HtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel,TProperty>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. 

Error #2: 
One or more types required to compile a dynamic expression cannot be found. Are you missing a reference? 

有什麼想法嗎?

萬一別人

回答

0

想知道,這裏是我如何解決它:

1. right click on the project -> select properties 
2. select Application 
3. change "target framework" (I was at 4.5, so I changed it to 4) 
4. change "target framework" to whatever it was before step 3 

web.config中被清理,適當引用添加,做一個構建,一切都應該恢復正常