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

来源:互联网 发布:免费发布新闻稿软件 编辑:程序博客网 时间:2024/04/28 07:04

开发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 stillthe same:'DefaultDomain': Loaded'c:windowsmicrosoft.netframeworkv1.0.3705mscorlib.dll', No symbolsloaded.'ImagemJoinGeometry': Loaded 'C:Documents andSettingsPatríciaAmbiente detrabalhoImagemJoinGeometrybinDebugImagemJoinGeometry.exe', Symbolsloaded.An unhandled exception of type 'System.IO.FileLoadException' occurredin 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çalvesCitando Peter Schmitt :Just a guess, but double check that the .dll is in the same directoryas the executeable you make and/or maybe try setting your PATHvariable to point to the dll?
“‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘以下文字是重点’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘I think Visual Studio creates a project directory with nesteddebug/release directories that store the executables on compile... sowhen you run the executable it looks for dlls in its directory, notone up.

-PeteOn 7/19/05, patgo at sapo.pt wrote:>>> Hi,>> I have just installed VTK to work with C#. As supposed, I havecopied> vtkDotNetWrap.dll to the project's directory and use it as areference. The> solution builds just fine but the project doesn't run. It presentsme the> following text:>> An unhandled exception of type 'System.IO.FileNotFoundException'occurred in> Unknown Module.> Additional information: File or assembly name vtkDotNetWrap, or oneof 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

 

原创粉丝点击