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:
- Open Visual Studio.
- Create a new project of type Class Library.
- 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.
- Added references (using or import) to the namespaces required for your
type of extension.
- Make sure your new class extends the appropriate base-class.
- Override the appropriate methods.
- Add any logging you require.
- Build the project.
Registering a .NET extension in CompleteFTP
Extensions must be registered with CompleteFTP. To do this:
- Open CompleteFTP Manager.
- Select the Extensions panel.
- Click 'Add extension'.
- Select '.NET Extension'.
- Select 'Extension type'. (e.g. 'Authentication')
- 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.
- Select the class of the extension. (A DLL file can contain more than one class, so user has to select a class)
- Input the name of editor class, including namespace. (Optionally)
- Some extension types require you to perform an additional registration step,
such as adding a new folder-type, or granting permissions to site-commands.
- Click the Apply button.
- 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: