我创造了在Visual Studio 2012年Windows窗体应用程序在Windows 8上,而目标.NET框架4.5,我想使用Windows SDK的DatagramSocket的库,所以我改变了目标OS版本8,当我编译。
我收到以下错误:
类型System.IDisposable的在未被引用的程序集中定义错误1。你必须添加一个引用程序集System.Runtime,版本= 4.0.0.0,文化=中性公钥= b03f5f7f11d50a3a。
解决方案如果您正在针对Windows 8的的 MSDN文档有如下说明:
这是说,你的桌面应用程序不能消耗太多的东西 Windows运行时,直到$ P $一个重要的ppare项目 参考。 Windows运行时定义了一些标准类和 在 System.Runtime 的接口,如的IEnumerable ,所使用的 整个Windows运行时库。默认情况下,您的管理 桌面应用程序将无法找到这些类型的,所以你必须 手动引用System.Runtime之前,你可以做任何事情 有意义的Windows运行时类。要创建本手册 参考:
希望有所帮助。
I created a Windows Form application in Visual Studio 2012 on Windows 8, and the target .NET framework is 4.5, and I want to use the Datagramsocket library of Windows SDK, so I changed the target OS version to 8, when I compile.
I am getting the following error:
"Error 1 The type 'System.IDisposable' 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'."
解决方案
If you are targeting Windows 8, the MSDN documentation has the following instructions:
That said, your desktop app can’t consume much of anything from the Windows Runtime until you prepare your project with one essential reference. The Windows Runtime defines some standard classes and interfaces in System.Runtime, such as IEnumerable, that are used throughout the Windows Runtime libraries. By default, your managed desktop app won’t be able to find these types, and so you must manually reference System.Runtime before you can do anything meaningful with Windows Runtime classes. To create this manual reference:
Hope that helps.
更多推荐
类型“System.IDisposable的”在未被引用的程序集中定义
发布评论