-
Notifications
You must be signed in to change notification settings - Fork 4
Building a Plugin
A plugin needs to be built as a "Class Library (.NET Framework)".
The Target Framework should be a recent ".NET Framework".
The platform target should be "Any CPU" or x64.
The Visual Studio project for building the plugin must include the Assembly for PluginInterfaces
as a reference.
The project must include the Assembly for EmbeddedUiPluginInterfaces
as a reference if it is using one of the interface classes that displays data in a Paratext window.
The assemblies can be found in the NuGet manager. Below are links to the assemblies:
After building a project to generate the plugin, it is necessary to copy the .dll file (and .pdb file if you are interested in debugging) to a folder for that plugin under the plugins
folder for the Paratext installation. Any .dll file(s) containing a plugin (i.e., an implementation of IParatext___Plugin), must be renamed to use the .ptxplg file extension in order to be recognized by Paratext (i.e. /plugins/{PluginFolder}/{PluginName}.ptxplg
). Paratext must not be running when doing these copies.
If you want the .dll and .pdb files to be automatically copied over then do the following:
- Create a system environment variable called ParatextInstallDir, set to the location where the Paratext executable is installed. (If you are a Paratext developer, this can be set to the location where you build development versions of Paratext.)
- Go to the Properties of the plugin project in Visual Studio.
- Navigate to the Build Events tab.
- In the Post-build event command line textbox paste:
- xcopy "$(TargetPath)" "%ParatextInstallDir%\plugins$(ProjectName)*.ptxplg" /y /i
- This will automatically copy the .dll file
- xcopy "$(TargetDir)$(TargetName).pdb" "%ParatextInstallDir%\plugins$(ProjectName)" /y /i
- This will automatically copy the .pdb file. The .pdb file is only necessary for debugging.
- xcopy "$(TargetPath)" "%ParatextInstallDir%\plugins$(ProjectName)*.ptxplg" /y /i
- Note: there will need to be one copy per .dll file and .pdb file needed by the plugin. Any supporting .dll files (that do not contain a plugin) should be copied over as normal .dll files and not be renamed with a .ptxplg extension.
- Note: If ParatextInstallDir points to a location that is protected by UAC (such as the default install location in Program Files), copying in a post-build step will fail unless you are running the build environment with elevated privileges. If you do not want to run the build environment using elevated privileges, you can copy the files manually after building or create a program to request elevated privileges and copy the files, and then run that program in the post-build step.