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

开发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

 

你可能感兴趣的:(thread,exception,String,Microsoft,Google,Youtube)