Using HtmlAgilityPack with MonoTouch app gives reference error

前端 未结 2 1693
盖世英雄少女心
盖世英雄少女心 2021-01-25 16:24

I\'m trying to use the Html Agility Pack with a MonoTouch application, but cannot find a version that will work with it.

I downloaded the latest binaries from CodePlex a

相关标签:
2条回答
  • 2021-01-25 17:14

    You have to compile it from code Download the source

    go into

    \htmlagilitypack-99964\Branches\1.4.0\HtmlAgilityPack
    

    Edit the csproj change to

    <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
    

    Save and load

    Fix errors

    Trace -> Debug

    Remove block

     if (!SecurityManager.IsGranted(new DnsPermission(PermissionState.Unrestricted)))
            {
                //do something.... not at full trust
                try
                {
                    RegistryKey reg = Registry.ClassesRoot;
                    reg = reg.OpenSubKey(extension, false);
                    if (reg != null) contentType = (string)reg.GetValue("", def);
                }
                catch (Exception)
                {
                    contentType = def;
                }
            }
    

    Remove block

     if (SecurityManager.IsGranted(new RegistryPermission(PermissionState.Unrestricted)))
            {
                try
                {
                    RegistryKey reg = Registry.ClassesRoot;
                    reg = reg.OpenSubKey(@"MIME\Database\Content Type\" + contentType, false);
                    if (reg != null) ext = (string)reg.GetValue("Extension", def);
                }
                catch (Exception)
                {
                    ext = def;
                }
            }
    

    Use the dll in the bin/debug folder

    0 讨论(0)
  • 2021-01-25 17:16

    Are you compiling from source or using the DLL directly?

    You will need to make a new MonoTouch library project and add all the files for it to work.

    Using a DLL directly likely won't work, since it was not compiled for MonoTouch.

    0 讨论(0)
提交回复
热议问题