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=184.108.40.20661, 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?