2012-08-23 66 views
2

我已經下載了最新版本的HtmlAgilityPack,其中發現了像Net20,Net40等幾個文件夾。我創建了一個新項目,並通過添加引用添加HtmlAgilityPack ..(I從Net20文件夾中選擇了.dll),然後編寫了一個簡單的代碼,其中添加了using HtmlAgilityPack;。所以現在我有一個符號不能用於使用聲明的錯誤。如何將HtmlAgilityPack添加到Visual Studio 2010項目

怎麼了?我想我對圖書館做錯了什麼。

using HtmlAgilityPack; 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 

int main() 
{ 
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument(); 

    // There are various options, set as needed 
    htmlDoc.OptionFixNestedTags=true; 

    // filePath is a path to a file containing the html 
    htmlDoc.Load(filePath); 

    // Use: htmlDoc.LoadXML(xmlString); to load from a string 

    // ParseErrors is an ArrayList containing any errors from the Load statement 
    if (htmlDoc.ParseErrors!=null && htmlDoc.ParseErrors.Count>0) 
    { 
     // Handle any parse errors as required 

    } 
    else 
    { 

     if (htmlDoc.DocumentNode != null) 
     { 
      HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body"); 

      if (bodyNode != null) 
      { 
       // Do something with bodyNode 
      } 
     } 
    } 
} 
+0

參考文件夾/ bin如果你要問非工作的代碼有錯誤,後_both_ **的**代碼的_and_ * *錯誤** ...不要讓我們猜測。 –

+0

不,我不問代碼,我問如何正確添加.dll – fen1ksss

+0

可能的重複[如何使用HTML敏捷包](http://stackoverflow.com/questions/846994/how-to -use-html-agility-pack) – SliverNinja

回答

0

通過右鍵添加引用單擊項目解決方案

相關問題