Strong name

Jan 10, 2012 at 10:04 AM

If I try to use the binary library  I get following compiling error: Assembly generation failed -- Referenced assembly 'Renci.SshNet' does not have a strong name

 

I also wonder how I can log what is happening in the background. I will connect me to FTP and want for diagnostic purposes logging the commands sent to the FTP server. Maybe have an event for each message sent

Then I wonder if there is support to download multiple files?

Coordinator
Jan 10, 2012 at 2:29 PM

I dont generate a strong name. If you application requires strong name, you can use source version and sign it with you key if you like.

 

As far as downloading multiple files, no there is no support for that becase you dont need it.

You can always loop thru files that need to be downloaded or uploaded. You can also execute multiple uploads or downloads at once if you wish.

 

Here an example I use in my test:

            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                sftp.Connect();

                var testInfoList = new Dictionary<string, TestInfo>();

                .....

                var uploadWaitHandles = new List<WaitHandle>();

                //  Start file uploads
                foreach (var remoteFile in testInfoList.Keys)
                {
                    var testInfo = testInfoList[remoteFile];
                    testInfo.UploadedFile = File.OpenRead(testInfo.UploadedFileName);

                    testInfo.UploadResult = sftp.BeginUploadFile(testInfo.UploadedFile,
                        remoteFile,
                        null,
                        null) as SftpUploadAsyncResult;


                    uploadWaitHandles.Add(testInfo.UploadResult.AsyncWaitHandle);
                }

                //  Wait for upload to finish
                bool uploadCompleted = false;
                while (!uploadCompleted)
                {
                    //  Assume upload completed
                    uploadCompleted = true;

                    foreach (var testInfo in testInfoList.Values)
                    {
                        var sftpResult = testInfo.UploadResult;

                        if (!testInfo.UploadResult.IsCompleted)
                        {
                            uploadCompleted = false;
                        }
                    }
                    Thread.Sleep(500);
                }

                //  End file uploads
                foreach (var remoteFile in testInfoList.Keys)
                {
                    var testInfo = testInfoList[remoteFile];

                    sftp.EndUploadFile(testInfo.UploadResult);
                    testInfo.UploadedFile.Dispose();
                }

                //  Start file downloads

                var downloadWaitHandles = new List<WaitHandle>();

                foreach (var remoteFile in testInfoList.Keys)
                {
                    var testInfo = testInfoList[remoteFile];
                    testInfo.DownloadedFile = File.OpenWrite(testInfo.DownloadedFileName);
                    testInfo.DownloadResult = sftp.BeginDownloadFile(remoteFile,
                        testInfo.DownloadedFile,
                        null,
                        null) as SftpDownloadAsyncResult;

                    downloadWaitHandles.Add(testInfo.DownloadResult.AsyncWaitHandle);
                }

                //  Wait for download to finish
                bool downloadCompleted = false;
                while (!downloadCompleted)
                {
                    //  Assume download completed
                    downloadCompleted = true;

                    foreach (var testInfo in testInfoList.Values)
                    {
                        var sftpResult = testInfo.DownloadResult;

                        if (!testInfo.DownloadResult.IsCompleted)
                        {
                            downloadCompleted = false;
                        }
                    }
                    Thread.Sleep(500);
                }

                //  End file downloads
                foreach (var remoteFile in testInfoList.Keys)
                {
                    var testInfo = testInfoList[remoteFile];

                    sftp.EndDownloadFile(testInfo.DownloadResult);

                }

                sftp.Disconnect();
            }

Hope it helps,

Thanks,

Oleg

May 15, 2013 at 6:00 PM
I also want to use the assembly referenced from an assembly that is signed. I'd like to put in a request for you to sign the released assemblies. It allows people like us to download the binary as is and not have to keep a copy of the source code that we build ourselves. Thanks.
Aug 8, 2013 at 6:31 PM
I also agree that it'd be nice for you to sign the assembly so we could just download the binary and not have to keep a copy of the source.
Aug 23, 2013 at 2:06 PM
I agree. Especially for use via Nuget