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
}
}
}
}
参考文件夹/ bin如果你要问非工作的代码有错误,后_both_ **的**代码的_and_ * *错误** ...不要让我们猜测。 –
不,我不问代码,我问如何正确添加.dll – fen1ksss
可能的重复[如何使用HTML敏捷包](http://stackoverflow.com/questions/846994/how-to -use-html-agility-pack) – SliverNinja