0

I have an old C# .NET 2.0 application, and I need to add a FTP client (cannot make due with the simple FtpWebRequest alas) and have tried to include the System.Net.FtpClient from https://netftp.codeplex.com/ This code autocompletes just fine when I type it:

System.Net.FtpClient.FtpClient client = new System.Net.FtpClient.FtpClient();

But I get the following error:

The type or namespace name FtpClient does not exist in the namespace System.Net

I have tried fixing this by setting an alias to the project reference System.Net.FtpClient (ftp instead of global) and then typing at the top:

extern alias ftp;

and I get

The extern alias ftp was not specified in a /reference option

If I change to .NET Framework 4.5 it seems that I can get around this issue, but my application is an old addon for SAP Business One, and changing from 2.0 to 4.5 gives me tens of other errors like some sap-classes that does not have a constructor etc, so unfortunately I cannot do this. Is there any other way I can make it work?

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
runholen
  • 850
  • 11
  • 24

1 Answers1

1

Looks like the binaries distributed for this library don't support v2.0

Have a look at the batch files used to build the project: https://netftp.codeplex.com/SourceControl/latest#create_codeplex_release.bat and https://netftp.codeplex.com/SourceControl/latest#create_nuget_release.bat

The both build it against v4

set msbuild=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe

I also tried installing the oldest version on NuGet but it still conflicts with framework Version 2.0.

But luckily they provide a project that supports v2. Download the source code and open the project named System.Net.FtpClient.NET2.csproj

Now you can use the output of this project instead of the downloaded binaries.

Hope this helps.

Volkan Paksoy
  • 6,727
  • 5
  • 29
  • 40