2018-11-29 16:00:00 +00:00
# WinSW extensions
2016-12-02 12:59:26 +00:00
2018-11-29 16:00:00 +00:00
Starting from WinSW 2.0, the wrapper provides an internal extension engine and several extensions.
2016-12-02 12:59:26 +00:00
These extensions allow to alter the behavior of the Windows service in order to setup the required service environment.
2018-11-27 16:00:00 +00:00
## Available extensions
2016-12-02 12:59:26 +00:00
2016-12-02 14:05:15 +00:00
* [Shared Directory Mapper ](sharedDirectoryMapper.md ) - Allows mapping shared drives before starting the executable
2016-12-02 12:59:26 +00:00
* [Runaway Process Killer ](runawayProcessKiller.md ) - Termination of processes started by the previous runs of WinSW
2018-11-27 16:00:00 +00:00
## Developer guide
2016-12-02 12:59:26 +00:00
2018-11-29 16:00:00 +00:00
In WinSW v2 the extension does not support inclusion of external extension DLLs.
2016-12-02 12:59:26 +00:00
2018-11-27 16:00:00 +00:00
### Adding external extensions
2016-12-02 12:59:26 +00:00
The only way to create an external extension is to create a new extension DLL and
then to merge this DLL into the executable using tools like `ILMerge` .
See the example in `src/Core/ServiceWrapper/winsw.csproj` .
Generic extension creation guideline:
* Extension DLL should reference the `WinSWCore` library.
* The extension should extend the `AbstractWinSWExtension` class.
* The extension then can override event handlers offered by the upper class.
2020-08-22 10:51:14 +00:00
* The extension should implement the configuration parsing from the `XmlNode` and `YamlExtensionConfiguration` .
2016-12-02 12:59:26 +00:00
* The extension should support disabling from the configuration file.
2020-08-22 10:51:14 +00:00
WinSW engine will automatically locate your extension using the class name in the [XML configuration file ](../xmlConfigFile.md ) or [YAML configuration file ](../yamlConfigFile.md ).
2016-12-02 12:59:26 +00:00
See configuration samples provided for the extensions in the core.
2016-12-04 08:34:19 +00:00
For extensions from external DLLs, the `className` field should also specify the assembly name.
It can be done via fully qualified class name or just by the `${CLASS_NAME}, ${ASSEMBLY_NAME}` declaration.
2016-12-02 12:59:26 +00:00
2018-11-29 16:00:00 +00:00
Please note that in the current versions of WinSW v2 the binary compatibility of extension APIs **is not guaranteed** .