仅在构建我的应用程序后才找到 HtmlAgilityPack 参考
我一直在 Visual Studio 中使用 HTMLAgilityPack,没有出现任何问题。我将 HtmlAgilityPack 解压到 HD 中,并添加文件 HtmlAgilityPack.dll 作为对我的 C# 应用程序的引用。同样,Visual Studio 中的一切都运行良好。然后,我构建了我的解决方案,并尝试在 Visual Studio 之外运行我的应用程序(作为独立的桌面可执行文件),当我运行我的应用程序时,出现以下错误:
“您的应用程序中发生了未处理的异常。如果您单击 继续,应用程序将...无法加载文件或程序集 'HtmlAgilityPack,版本=1.4.0.0。 Culture=neutral.PublicKeyToken=bd319b...' 或其依赖项之一。 系统找不到指定的文件。”
怎么可能找不到指定的文件?Visual Studio 毫无困难地找到它...
我可以根据要求提供任何其他信息。
感谢您对此的任何帮助一——埃文
I have been using HTMLAgilityPack from within Visual Studio without a single problem. I extracted HtmlAgilityPack to my HD, and added the file HtmlAgilityPack.dll as a reference to my C# application. Again everything is working splendid from within Visual Studio. I then built my solution and attempted to run my application outside of visual studio (as a standalone desktop executable file) and I get the following error when I run my application:
"Unhanded exception has occurred in your application. If you click
Continue, the application will .... Could not load file or assembly
'HtmlAgilityPack, Version=1.4.0.0.
Culture=neutral.PublicKeyToken=bd319b...' or one of its dependencies.
The system cannot find the file specified."
How is is possible that the system can't find the file specified? Visual Studio had no trouble finding it...
I can provide any additional information upon request.
Thank you for any help with this one - Evan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想出了这个。问题是我使用的是 HtmlAgilityPack 的实验副本。我切换到“完整”版本此处,现在一切正常!
I figured this one out. The problem was that I was using an EXPERIMENTAL copy of HtmlAgilityPack. I changed over to the 'full' version HERE and everything works great now!
您的程序需要程序集 HtmlAgilityPack.dll 才能运行。运行时,CLR会在几个宫殿中寻找它。最方便的是:
因此,要么确保 HtmlAgilityPack.dll 与 EXE 位于同一目录中,要么将其放入 GAC 中(使用 gacutil.exe)。
The assembly HtmlAgilityPack.dll is needed for your program to run. At runtime, the CLR will look for it in several palaces. The most convenient ones are:
So either make sure HtmlAgilityPack.dll is in the same directory as you EXE, or put it into the GAC (using gacutil.exe).
构建解决方案而不仅仅是项目。
选择您的解决方案并按 ctrl + Shift + B
Build the solution not only the project.
Select your solution and press ctrl + Shift + B