How to write a .NET extension

A CompleteFTP .NET Extension is a .NET assembly, usually a DLL, which contains a class that extends the one of the CompleteFTP extension base-classes (see below). The assembly can be developed in C#, VB.NET or any other .NET language. If you don't already have Visual Studio then you can use one of Microsoft's free Visual Studio Express or Community products. This feature is only available in the Enterprise Edition.

Creating a .NET extension

To create a CompleteFTP .NET extension:

  1. Open Visual Studio.
  2. Create a new project of type Class Library.
  3. Add a reference to the CompleteFTPServer.dll. You can find this in the directory C:\Program Files\CompleteFTP\Server. If you are on a 64-bit machine then it will be in C:\Program Files (x86)\CompleteFTP\Server. Make sure the Specific Version property is set to false so that you don't have to rebuild the assembly each time you upgrade CompleteFTP.
  4. Added references (using or import) to the namespaces required for your type of extension.
  5. Make sure your new class extends the appropriate base-class.
  6. Override the appropriate methods.
  7. Add any logging you require.
  8. Build the project.

Registering a .NET extension in CompleteFTP

Extensions must be registered with CompleteFTP. To do this:

  1. Open CompleteFTP Manager.
  2. Select the Extensions panel.
  3. Click 'Add extension'.
  4. Select '.NET Extension'.
  5. Select 'Extension type'. (e.g. 'Authentication')
  6. Select .NET Assembly file in Select .NET Assembly Dialog. Note that the assembly is read by the System user, so this user must have access to the file.
  7. Select the class of the extension. (A DLL file can contain more than one class, so user has to select a class)
  8. Input the name of editor class, including namespace. (Optionally)
  9. Some extension types require you to perform an additional registration step, such as adding a new folder-type, or granting permissions to site-commands.
  10. Click the Apply button.
  11. Test your .NET Extension by using a FTP client

Reloading a .NET extension in CompleteFTP

.NET assemblies cannot be reloaded if they are altered. If you need to make a change to the code of the extension then you will need to restart the CompleteFTP service to force it to reload the DLL. While developing it is sometimes helpful to run CompleteFTP in console mode. This may be done by closing the CompleteFTP servie and then selecting Run server in console from the Window start menu.

.NET Framework Versions

The .NET assembly file must be built with a version of the .NET Framework runtime that the same as or older than the .NET Framework version on which CompleteFTP is running. This can be controlled by editing the supportedRuntime element in the file, CompleteFTPService.exe.config in the Complete FTP installation folder. E.g. if you want your CompleteFTP's extensions run on .NET Framework 4.0, you need make sure that 4.0 appears before 2.0 inside the supportedRuntime element and that .NET 4.0 is installed on your machine.

Types of .NET Extensions

For details on the type of .NET extension that you are developing please go to: