使用Windows上的Visual Studio15.8.1(在使用Parallels
的mac上运行),我使用Xamarin.iOS创建了一个iOS应用程序,目标是iOS 11.4。为了构建应用程序,我在运行最新版本Xamarin 11.14.0.11的macOS上设置了一个构建代理。
然后我创建了一个新的.netstandard 2.0
库,它引用了微软的NuGet包System.Drawing.Common
。
在该库中,我添加了以下类:
using System.Drawing;
namespace library
{
public class SomeClass
{
private readonly Bitmap m_bitmap;
public SomeClass(Bitmap bitmap)
{
m_bitmap = bitmap;
}
}
}
然后,该库被iOS项目引用,一切都构建得很好。
在iOS项目的ViewController
中,我添加了以下使用前一个类的代码,并添加了对System.Drawing.Common
包的引用,以便能够使用Bitmap
类:
public partial class ViewController : UIViewController
{
private SomeClass m_someClass;
public ViewController (IntPtr handle) : base (handle)
{
m_someClass = new SomeClass(new System.Drawing.Bitmap());
}
// ...
}
现在,它构建失败,我得到以下错误:
错误CS0234:类型或命名空间名称'Bitmap‘在命名空间'System.Drawing’中不存在(是否缺少程序集引用?)
错误CS7069:对类型'Bitmap‘的引用声明它是在'System.Drawing.Common’中定义的,但找不到它
问题
我跟踪了the answer to that question。一切都是最新的(macOS上的Visual Studio和Xamarin )。我尝试手动将System.Drawing.Common
从包的.netstandard20
复制到输出,并将其作为引用直接添加到项目中。我从来没有让任何东西工作过。
应该做些什么?
https://stackoverflow.com/questions/51938431
复制相似问题