.NET Assembly not working

Advertisement

dtrowan
Joined:
Posts:
3
Location:
Australia

.NET Assembly not working

I downloaded version 5.1.5 of WinSCP.exe (portable) and the .NET / COM Package to develop a simple VB.Net program to download some files from an SFTP server.

I added WinSCP.exe to the project and it gets copied when compiling to the directory with the program. I added a reference to the WinSCP.dll which i renamed to WinSCPnet.dll. When looking at the references page it copies it locally (like it should as it came from a network location). I was able to code the project with Visual Studio recognizing all functions and providing the tooltips to me. However, when i run it i get:

Could not load file or assembly 'WinSCP, Version=1.0.6.3261, Culture=neutral, PublicKeyToken=b5f19f5762436b89' or one of its dependencies. The module was expected to contain an assembly manifest.

When i comment out the session or sessionoptions code and declarations i can run the program, however with them i get the above message.

I searched on the forum and it suggested to use RegAsm to register it. When i run the command i get this:

G:\Utilities For Everyone\WinSCP\5.1.5>C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase /tlb
Microsoft (R) .NET Framework Assembly Registration Utility 4.0.30319.1
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.

RegAsm : error RA0000 : Could not load file or assembly 'file:///G:\Utilities For Everyone\WinSCP\5.1.5\WinSCPnet.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

I have even tried adding this to the application config file:

    <runtime>
        <loadFromRemoteSources enabled="true" />
    </runtime>

But that didn't work either. Is there any suggestions?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: .NET Assembly not working

Have you tried not renaming the assembly? (you will obviously need to remove the winscp.exe from the project and copy it to the output folder manually).

Reply with quote

Advertisement

You can post new topics in this forum