首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Xamarin.iOS无法识别引用的System.Drawing.Common中的“Bitmap”类型

Xamarin.iOS无法识别引用的System.Drawing.Common中的“Bitmap”类型
EN

Stack Overflow用户
提问于 2018-08-21 05:01:30
回答 1查看 1K关注 0票数 1

使用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

在该库中,我添加了以下类:

代码语言:javascript
复制
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类:

代码语言:javascript
复制
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复制到输出,并将其作为引用直接添加到项目中。我从来没有让任何东西工作过。

应该做些什么?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51938431

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档