Topic "Failure on using .NET assembly in VB2010"

Author Message
kitsune
[View user's profile]

Joined: 2013-04-16
Posts: 2
I have referenced the WinSCP.dll in my project.
With the import command (Imports WinSCP), the session object and the events called in the VB.net syntax are fine.

However, once I deploy by running in debug mode. VB prompts the error message as below:
"Could not load file or assembly 'WinSCP, Version=1.0.5.2937, Culture=neutral, PublicKeyToken=b5f19f5762436b89' or one of its dependencies. The module was expected to contain an assembly manifest."

Would someone advise on this?
Thanks so much!
Advertisements
gjs
[View user's profile]

Joined: 2012-07-11
Posts: 10
It's a naming conflict between winscp.dll and winscp.exe. VS tries to load the exe thinking it is the referenced dll. I found that I must just reference the dll in my project and so it is copied to the output directory but do not include winscp.exe in the project just copy it to the output directory, so the dll knows where to find it.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
gjs wrote:
It's a naming conflict between winscp.dll and winscp.exe. VS tries to load the exe thinking it is the referenced dll. I found that I must just reference the dll in my project and so it is copied to the output directory but do not include winscp.exe in the project just copy it to the output directory, so the dll knows where to find it.

Thanks, that's correct.
See https://winscp.net/eng/docs/library_install#vs
_________________
Martin Prikryl
kitsune
[View user's profile]

Joined: 2013-04-16
Posts: 2
Thanks all.

However, I have read the page https://winscp.net/eng/docs/library_install#vs before and have renamed the dll file as suggested before including in the reference.
Also, I have copied the exe file to the debug folder but the problem is not yet solved.
Thus, I made this post and would like to have advice from you all experts.

Please also find the attached screen capture of my vs debug environment for reference.
Would someone advise on this?
Thanks so much!
WinSCP location.jpg (99.99 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Do you have .NET framework 2.0 available on your machine?
_________________
Martin Prikryl
ninem
[View user's profile]

Joined: 2013-07-18
Posts: 1
Location: Thailand
Same problem with me and i waiting for new solution.
gsclarke
[View user's profile]

Joined: 2013-11-21
Posts: 3
Hello All,

I have just gone through the installation and am experiencing the same problem. The DLL is renamed and registered in V4.0.xxxx .NET framework (as per the install page), but when the app is run, get the same error message:

"Could not load file ... blah blah ... system could not find the file specified." I did pick up a version discrepancy between the DLL and EXE files, and I have fixed that and also copied the EXE file to the project "obj" folder, but still getting the same problem.

Any further thoughts on the problem.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
gsclarke wrote:
I have just gone through the installation and am experiencing the same problem. The DLL is renamed and registered in V4.0.xxxx .NET framework (as per the install page), but when the app is run, get the same error message:

"Could not load file ... blah blah ... system could not find the file specified." I did pick up a version discrepancy between the DLL and EXE files, and I have fixed that and also copied the EXE file to the project "obj" folder, but still getting the same problem.

Have you tried to debug this using fuslogvw?
_________________
Martin Prikryl
gsclarke
[View user's profile]

Joined: 2013-11-21
Posts: 3
prikryl wrote:
Have you tried to debug this using fuslogvw?


Many thanks - that tool did the trick. The problem was that the Winscp.* files were not in the project's bin/debug directory where I was running the application from. I then stumbled onto the next problem with the invalid manifest error. There seems to be a bit of confusion with the install instructions...

According to the instructions, the DLL must be renamed to winscpnet.dll (anything other than winscp.dll to avoid confusion with winscp.exe) and then added to the project as a reference. However, the invalid manifest problem was solved if I renamed the file back to winscp.dll.

I just need to sort out my sshhostkey value and then I can confirm if everything is working properly.
gsclarke
[View user's profile]

Joined: 2013-11-21
Posts: 3
All is good in the WinSCP world!

Cool

I successfully ran through my program to upload a file to SFTP sever. So, it appears the DLL name should be "winscp.dll" in the project/bin/debug|release/ folder.

PS: Running VS2012 Pro on Win7.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
gsclarke wrote:
I successfully ran through my program to upload a file to SFTP sever. So, it appears the DLL name should be "winscp.dll" in the project/bin/debug|release/ folder.

Ok, thanks for your investigation. Alternatively, you can use WinSCP 5.2.x assembly that is built as winscpnet.dll.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License