n unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.Additional information: 未能加载文件或程序集“..

ERROR 专栏收录该内容
7 篇文章 0 订阅

开发youtube项目,做了一个控制台程序来试验一些功能。代码如下

 

#include "stdafx.h"

#using <mscorlib.dll>

#using <C:/Program Files/Google/Google Data API SDK/Redist/Google.GData.YouTube.dll>

#using <C:/Program Files/Google/Google Data API SDK/Redist/Google.GData.Client.dll>

#using <C:/Program Files/Google/Google Data API SDK/Redist/Google.GData.Extensions.dll>

 

using namespace System;

using namespace Google::GData::YouTube;

using namespace Google::YouTube;

 

using namespace Google::GData::Client;

using namespace Google::GData::Extensions;

using namespace Google::GData::Extensions::MediaRss;

 

 

int _tmain(int argc, _TCHAR* argv[])

{

System::String^ authToken;

//YouTubeRequest^ request;

System::String^ AppKey = "NotifierYT";

System::String^ YTCLIENTID = "clientID";// "ytapi-FrankMantek-TestaccountforGD-sjgv537n-0";

System::String^ YTDEVKEY = "AI39si50H0HOXR09HlrMTqpChQAUG8dOl5pTyPMNjj5DFqtx1cYSJQsea6-nbRr9ZLQNu8aia5J3aR1UNOJVZ_qa7c1hF2UdSQ";// "AI39si4v3E6oIYiI60ndCNDqnPP5lCqO28DSvvDPnQt-Mqia5uPz2e4E-gMSBVwHXwyn_LF1tWox4LyM-0YQd2o4i_3GcXxa2Q";

System::String^ userName = "username**";

System::String^ passWord = "password**";

 

Google::YouTube::YouTubeRequestSettings^ settings = gcnew Google::YouTube::YouTubeRequestSettings(AppKey,

YTCLIENTID,

YTDEVKEY,

userName,

passWord);

// settings.PageSize = 15;

YouTubeRequest^ request = gcnew YouTubeRequest(settings);

 

try

{

YouTubeService^ service=request->Service;

authToken = service->QueryAuthenticationToken();

passWord = "";

}

catch(int)

{

Console::WriteLine("There was a problem with your credentials");

authToken = nullptr;

}

 

 

 

     return 0;

}

 

 

编译链接都通过,按F5运行时报错,output窗口输出错误如下,

//BEGIN

First-chance exception at 0x7c812afb in ad.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..

 

First-chance exception at 0x7c812afb in ad.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..

 

A first chance exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.

 

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module. Additional information: 未能加载文件或程序集“Google.GData.YouTube, Version=1.4.0.2, Culture=neutral, PublicKeyToken=af04a32718ae8833”或它的某一个依赖项。系统找不到指定的文件。

 

The thread 'Win32 Thread' (0x8e4) has exited with code 0 (0x0). The thread 'Main Thread' (0xc28) has exited with code 0 (0x0). The program '[2292] ad.exe: Managed' has exited with code 0 (0x0). The program '[2292] ad.exe: Native' has exited with code 0 (0x0).

//END

这个问题困扰了挺久,在网上搜答案,一篇文章的方法试了一下结果成果了。

将外部相关#using的dll文件copy到exe目录下,即本人将Google.GData.YouTube.dll, Google.GData.Client.dll 和 Google.GData.Extensions.dll拷贝到了exe文件所在的文件夹下,结果OK搞定。高兴啊

 

==================================================================

http://www.vtk.org/pipermail/vtkusers/2005-July/080896.html

=================================================================

 

Thank you, Peter, but that didn't work either! The answer is still
the same:

	'DefaultDomain': Loaded
'c:windowsmicrosoft.netframeworkv1.0.3705mscorlib.dll', No symbols
loaded.

'ImagemJoinGeometry': Loaded 'C:Documents and
SettingsPatríciaAmbiente de
trabalhoImagemJoinGeometrybinDebugImagemJoinGeometry.exe', Symbols
loaded.

An unhandled exception of type 'System.IO.FileLoadException' occurred
in Unknown Module.

Additional information: Unable to load file 'vtkDotNetWrap'.

The program '[2692] ImagemJoinGeometry.exe' has exited with code 0
(0x0).

	Does anybody know how to prevent this? What can I do?

	Thank you,
Patrícia Gonçalves

Citando Peter Schmitt 

	:

Just a guess, but double check that the .dll is in the same directory
as the executeable you make and/or maybe try setting your PATH
variable to point to the dll?

“‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘以下文字是重点’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘
I think Visual Studio creates a project directory with nested
debug/release directories that store the executables on compile... so
when you run the executable it looks for dlls in its directory, not
one up.

-Pete

On 7/19/05, patgo at sapo.pt 

	wrote:
>
>
> Hi,
>
> I have just installed VTK to work with C#. As supposed, I have
copied
> vtkDotNetWrap.dll to the project's directory and use it as a
reference. The
> solution builds just fine but the project doesn't run. It presents
me the
> following text:
>
> An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in
> Unknown Module.
> Additional information: File or assembly name vtkDotNetWrap, or one
of its
> dependencies, was not found.
>
> Does anybody know how to prevent this? What can I do?
>
> Thank you,
> Patrícia Gonçalves
> ___________________________________________________________________
>
> O SAPO já está livre de vírus com a Panda Software, fique você
também!
> Clique em: http://antivirus.sapo.pt
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>

--
Pete

 

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值