我在Windows 8上的Visual Studio 2012中创建了一个Windows窗体应用程序,目标.NET框架是4.5,我想使用Windows SDK的Datagramsocket库,因此我在编译时将目标操作系统版本更改为8.
我收到以下错误:
"错误1类型'System.IDisposable'在未引用的程序集中定义.您必须添加对程序集'System.Runtime,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'的引用."
当我尝试使用版本4.0.30506(不幸的是我们现在绑定到此版本的ASP.NEt Web API)的Microsoft.AspNet.WebApi.HelpPage nuget包时,我收到以下错误.我使用的是Windows 7和.NET 4.5.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: 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'.
Source Error:
Line 11:
Line 12: // Group APIs by controller
Line 13: ILookup<string, ApiDescription> apiGroups = …
Run Code Online (Sandbox Code Playgroud) @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)
我在另一个没有出现此错误的项目中使用了这种类似的方法.