Is it possible to make a .NET 3.5 version?

Aug 19, 2011 at 1:01 AM

Visual Studio isn't letting me build my project since the library is aimed for .NET 4.0. Is it possible that you/I can make a 3.5-compatible version?

Coordinator
Aug 19, 2011 at 1:18 PM

At the moment I am targeting 4.0 but I think it should be possible to make it compatible with 3.5

Unfortunatly I dont have time for it right now, but when I was looking at it some time back, you need to replace quite a few things to make it work in 3.5, mostly have to do with parallelism.

If you like to add support for 3.5 by may be adding partial classes simialr to *.NET40.cs that I have,

then I could include it in source for future release so you dont have to do those modifications again in future versions.

 

Thanks,

Oleg

Aug 24, 2011 at 5:22 PM

Hi.

It is really possible to make it compatible with 3.5.

Actually all *.NET40.cs stuff may be kept in place without changes by referencing System.Threading.dll from Rx for 3.5 SP1. But there are still some unsupported features:

1. string.IsNullOrWhiteSpace() - could be replaced by string.IsNullOrEmpty or writing a custom IsNullOrWhiteSpace extension method.

2. .Dispose() on Socket, WaitHandle and HashAlgorythm - adding extension methods for that classes and calling Close() (or Clear) is just enough. Or you may replace Dispose calls in code with Close/Clear calls.

3. string.Join(string, IEnumerable<string>) - just call .ToArray() on enumerable.

4. dynamic - that's the biggest stopper. For SftpSession it is just enough to remove dynamic declaration and use type cast. But in the Session class dynamic is used to choose handler method by argument type, so you need a bit of reflection to determine a correct method. Fortunately Session class is partial, so you could add another part (with reflection code) to another file (I named it NET35Compat.cs), so changes in the original code would be minimal.

Aug 24, 2011 at 10:47 PM

Oleg, maybe create an "issue" for 3.5 compatibility? This way developers can up-vote it (only if registered on codeplex), and we will know how important it is for developers. Because right now it's 2 people out of 122 (incl. the 2) that follow this project, that appears to be wanting 3.5 compatibility.

Also 3.5 savvy people will be able to add suggestions for how to work around compatibility with 3.5 and 4.0, making it more a discussion - yes, but I think we can dual-use that issue for discussion and suggestions. My reasoning is that 3.5 developers "really need" this library, instead of developing their own. If 3.5 devs have made modifications to SSH Net already, they can push patches and I can review them, and then after my review, I can tell you if the patch works as intended. So pieceofsummer appears to be the 3.5 dev that know how to make changes but still struggle with 4.0 vs 3.5 compat, and he/she is willing to make proposals.

I don't know, but if pieceofsummer will commit continously to helping with the 3.5 part, say via patches or discussions/issues this will be a motivator for us to rethink 3.5 compat.

Now with all that said, this project was created in mind to fully use 4.0 features. The 2.0 was the latest and greatest, with good features and a solid base, but now we're already at 4.0, so with new paradigms arriving every 2 version or so, 4.0 will be the new 2.0, and 2.0 will become 1.0/1.1. Businesses still use Windows XP, they probably still need features this library can provide. I do not reccomend providing support for the not-so-much-secure Windows XP, that will just allow XP to live on, and by not supporting XP, tech departments must confront their bosses that new software and perhaps hardware is required for a newer operating system. Resulting in that those who need this library, runs it on Windows much better secure than XP.

The point is that SSH is a way to communicate securely with a remote server over unsecure networks, allowing trust to the software and the procedure or process.

This is my mindset.

Aug 24, 2011 at 11:50 PM

The only reason I ask for 3.5 compatibility is because my boss is being wary with the 4.0 switch.

It cuts out some operating systems and requires some more memory. He's saying our clients use ANCIENT machines and that 4.0 would be too much, but 3.5 is just fine.

I'm not asking this just to be that guy. But up until now I've been Mr. Solutions to him, and forcing something on him is something new to the environment.

And don't get me wrong. I would LOVE to contribute to this project. But I know nothing about the code behind SSH. I just use it.

Aug 25, 2011 at 11:56 AM

As for me, I had to backport to 3.5 because of the environment where the library is used. It is technically impossible for us to switch to 4.0 (dll is loaded as an extension to another program which cannot be altered).

So 3.5 is really needed. And since it's my job to keep it working, maintaining 3.5 compatibility is a need for me. It would be even easier for me it the patches are commited into the codebase, so I don't need to reapply them for every new revision.

So I agree on a vote. If there are enough people who need it, I will commit my patches.

Coordinator
Aug 25, 2011 at 12:30 PM

Ok,

So I guess what I will do is to create a new project .NET35 which will reference most of the files from .NET40 and then simply create partial files for .NET35 specific functionality and will see how it works.

The only thing is I just will need you guys to test it, since I dont work with 3.5 anymore.

 

Let me know what you think?

 

Thanks,

Oleg

Coordinator
Aug 25, 2011 at 2:02 PM

Hi,

 

I just added another project that in the future will have .NET 3.5 support,

I took care of some of the problems but it still has few more that need to be resolved before it can compile.

I will try to take a look at it a little bit later but if some of you would like to take a lead on this please let me know and I can add you as a developer so you could implement those changes directly in the code.

 

Thanks,

Oleg

Coordinator
Aug 25, 2011 at 8:17 PM

I just checked in a version which includes a projects that compiles .NET 3.5 assembly.

pieceofsummer, thank you for the patch.

Please take a look and let me know if you have any problems.

 

Thanks,

Oleg

Aug 25, 2011 at 11:02 PM
Edited Aug 25, 2011 at 11:10 PM

I'm getting 57 errors from the .NET 3.5 version. I can attempt to fix them, like the NoWhiteSpace function, but most of this stuff is over my head. I'm still working towards my Associate's in Software Engineering, so I'm not necessarily the smartest light bulb in the knife drawer.

Error    3    Predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported    Renci.SshNet.NET35
Error    4    Predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported    Renci.SshNet.NET35
Error    5    'System.Security.Cryptography.HashAlgorithm.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Security\Cryptography\RsaDigitalSignature.cs    67    36    Renci.SshNet.NET35
Error    6    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\ForwardedPortLocal.cs    67    53    Renci.SshNet.NET35
Error    7    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet.NET35\ForwardedPortLocal.NET35.cs    88    41    Renci.SshNet.NET35
Error    8    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\NoneConnectionInfo.cs    121    55    Renci.SshNet.NET35
Error    9    'System.Net.Sockets.Socket.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\ChannelDirectTcpip.cs    130    26    Renci.SshNet.NET35
Error    10    'System.Net.Sockets.Socket.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\ChannelForwardedTcpip.cs    140    30    Renci.SshNet.NET35
Error    11    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\ForwardedPortRemote.cs    155    53    Renci.SshNet.NET35
Error    12    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    171    24    Renci.SshNet.NET35
Error    13    'System.Security.Cryptography.HashAlgorithm.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Security\Cryptography\DsaDigitalSignature.cs    175    36    Renci.SshNet.NET35
Error    14    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\KeyboardInteractiveConnectionInfo.cs    175    55    Renci.SshNet.NET35
Error    15    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\PasswordConnectionInfo.cs    181    55    Renci.SshNet.NET35
Error    16    'System.Net.Sockets.Socket.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\ChannelDirectTcpip.cs    184    30    Renci.SshNet.NET35
Error    17    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\ChannelDirectTcpip.cs    190    34    Renci.SshNet.NET35
Error    18    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    192    24    Renci.SshNet.NET35
Error    19    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\SubsystemSession.cs    195    54    Renci.SshNet.NET35
Error    20    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\ChannelDirectTcpip.cs    196    35    Renci.SshNet.NET35
Error    21    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\ChannelDirectTcpip.cs    202    35    Renci.SshNet.NET35
Error    22    One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?    Renci.SshClient\Renci.SshNet\Sftp\SftpSession.cs    210    29    Renci.SshNet.NET35
Error    23    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    213    24    Renci.SshNet.NET35
Error    24    One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?    Renci.SshClient\Renci.SshNet\Sftp\SftpSession.cs    216    35    Renci.SshNet.NET35
Error    25    One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?    Renci.SshClient\Renci.SshNet\Sftp\SftpSession.cs    216    61    Renci.SshNet.NET35
Error    26    One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?    Renci.SshClient\Renci.SshNet\Sftp\SftpSession.cs    216    148    Renci.SshNet.NET35
Error    27    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\PrivateKeyConnectionInfo.cs    218    73    Renci.SshNet.NET35
Error    28    One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?    Renci.SshClient\Renci.SshNet\Sftp\SftpSession.cs    221    25    Renci.SshNet.NET35
Error    29    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Sftp\SftpSession.cs    240    48    Renci.SshNet.NET35
Error    30    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\ConnectionInfo.cs    247    24    Renci.SshNet.NET35
Error    31    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Shell.cs    256    43    Renci.SshNet.NET35
Error    32    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    262    24    Renci.SshNet.NET35
Error    33    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    265    24    Renci.SshNet.NET35
Error    34    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Shell.cs    305    55    Renci.SshNet.NET35
Error    35    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Shell.cs    311    55    Renci.SshNet.NET35
Error    36    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\ChannelSession.cs    347    53    Renci.SshNet.NET35
Error    37    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\ChannelSession.cs    353    46    Renci.SshNet.NET35
Error    38    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    373    24    Renci.SshNet.NET35
Error    39    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    432    24    Renci.SshNet.NET35
Error    40    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\SshCommand.cs    476    61    Renci.SshNet.NET35
Error    41    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    511    24    Renci.SshNet.NET35
Error    42    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\Channel.cs    631    55    Renci.SshNet.NET35
Error    43    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\Channel.cs    636    61    Renci.SshNet.NET35
Error    44    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\Channel.cs    641    54    Renci.SshNet.NET35
Error    45    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Channels\Channel.cs    646    54    Renci.SshNet.NET35
Error    46    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    843    60    Renci.SshNet.NET35
Error    47    'System.Net.Sockets.Socket.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    847    38    Renci.SshNet.NET35
Error    48    'System.Security.Cryptography.HashAlgorithm.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    1123    33    Renci.SshNet.NET35
Error    49    'System.Security.Cryptography.HashAlgorithm.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    1129    33    Renci.SshNet.NET35
Error    50    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    1145    24    Renci.SshNet.NET35
Error    51    'string' does not contain a definition for 'IsNullOrWhiteSpace'    Renci.SshClient\Renci.SshNet\SftpClient.cs    1185    24    Renci.SshNet.NET35
Error    52    One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?    Renci.SshClient\Renci.SshNet\Session.cs    1487    25    Renci.SshNet.NET35
Error    53    'System.Net.Sockets.Socket.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    1559    38    Renci.SshNet.NET35
Error    54    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    1567    56    Renci.SshNet.NET35
Error    55    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    1573    47    Renci.SshNet.NET35
Error    56    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    1579    51    Renci.SshNet.NET35
Error    57    'System.Threading.WaitHandle.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    1585    62    Renci.SshNet.NET35
Error    58    'System.Security.Cryptography.HashAlgorithm.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    1591    41    Renci.SshNet.NET35
Error    59    'System.Security.Cryptography.HashAlgorithm.Dispose(bool)' is inaccessible due to its protection level    Renci.SshClient\Renci.SshNet\Session.cs    1597    41    Renci.SshNet.NET35

Coordinator
Aug 26, 2011 at 12:53 PM

ops,

 

Sorry about that,

I just discovered this morning that whatever I tried to check in yesterday was still sitting in confirmation mode.

I guess I just forgot to check it if it was checked in last night.

 

Please check 9870 change set which should include those changes and let me know if it still does not compile.

 

Thanks,

Oleg

Aug 26, 2011 at 2:20 PM

It compiles. Thanks a lot, man.

Jan 2, 2012 at 12:03 PM

Hi All,

I am a novice in .net area,  I have a requirement to connect to Unix box through SSH from a Dotnet program to start and stop unix packages.     I feel I can use this SSH library to accomplish my task.   Can anyone please guide me on how to reference this library into a new C# program and use the basic functionality.   

Regards,

Darshan