Don*_*sen 5 c# asp.net asp.net-mvc razor asp.net-mvc-4
@using (Html.BeginForm("Index", "Employees", FormMethod.Post, new { encType = "multipart/form-data", name = "EmployeeForm" }))
{
<table class="table table-bordered table-condensed table-striped">
<tr>
<th>
Name
</th>
<th>
Surname
</th>
<th>
ID Number
</th>
<th>
Email
</th>
<th>
Birthdate
</th>
<th>
Action
</th>
</tr>
@Html.EditorFor(model => model.Employees)
</table>
}
Run Code Online (Sandbox Code Playgroud)
第32行:@ Html.EditorFor(model => model.Employees)给出以下错误
CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Run Code Online (Sandbox Code Playgroud)
我在另一个没有出现此错误的项目中使用了这种类似的方法.
hut*_*oid 18
在web.config中查找:
<compilation debug="true" targetFramework="4.5"/>
Run Code Online (Sandbox Code Playgroud)
添加System.Runtime程序集如下:
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
</compilation>
Run Code Online (Sandbox Code Playgroud)
这通常是由MVC和PCL引起的,详见下文:
类型'System.Object'是在非引用的程序集中定义的(MVC + PCL问题)
| 归档时间: |
|
| 查看次数: |
5060 次 |
| 最近记录: |