Using the .NET Workflow SDK with Geocortex Workflow Server
Geocortex Workflow Server can be extended by augmenting your on-premises installation with additional custom .NET assemblies.
Requirements
Extending Geocortex Workflow Server requires administrative access to your on-premises installation of workflow.
Development Environment
Visual Studio 2019 is the only officially supported development environment for extending Geocortex Workflow Server.
Setting up a Geocortex Workflow Server Extension Project
Extending Geocortex Workflow Server requires you to produce a separate assembly with your custom activities, and copy that into your on-premises deployment of Geocortex Workflow. We first need to set up a project using Visual Studio that references the workflow runtime.
- Launch Microsoft Visual Studio 2019.
- Create a new project of type Class Library (.NET Standard)
- You can also create a project of type .NET Core to take advantage of its larger feature set. If so, you need to go into the project settings and change the output type to
Class Library
- You can also create a project of type .NET Core to take advantage of its larger feature set. If so, you need to go into the project settings and change the output type to
- Edit the
.csprojfile in a text editor and add theCopyLocalLockFileAssembliesattribute to thePropertyGroup.
- This will copy the referenced nuget assemblies to the build output folder, which will be important for later.
- Add a reference to the
Geocortex.Workflow.Runtimeassembly. By default, this is located inC:\Program Files\Latitude Geographics\Geocortex Workflow\Deployment\service
important
.NET Standard projects must target .NET Standard 2.0, and .NET Core projects must target .NET Core 2.1, else the assembly will be incompatible with Geocortex Workflow Server
Next, learn how to implement a custom activity for Geocortex Workflow Server.
Deploying Geocortex Workflow Server Activities
For Geocortex Workflow Server to find your custom activities, you need to copy the build output to a particular folder.
- Build the project.
- Find the build output on disk.
- In Visual Studio, right-click on your project in Solution Explorer and choose "Open Folder in File Explorer".
- Open the
binfolder. If you do not see abinfolder, it is possible you right-clicked on the solution instead of the project. - In the
binfolder, open eitherDebugorRelease, depending on which build configuration you used. - In the
bin\Debugorbin\Releasefolder, there will be one final sub-directory which will benetstandard2.0ornetcore2.1. Open this folder. - You should now see a number of files including
Geocortex.Workflow.Runtime.dlland your own project, such asAssemblyNamespace.dll.
- Find the
CustomAssembliesfolder on disk.- Geocortex Workflow looks in a folder called
CustomAssembliesfor assemblies that contain custom activities. This is located in the folder that you chose when installing Geocortex Workflow. The default location isC:\Program Files\Latitude Geographics\Geocortex Workflow\CustomAssemblies
- Geocortex Workflow looks in a folder called
- Copy the relevant files from the build output to the
CustomAssembliesfolder.- Copy your project's assembly. (e.g.
AssemblyNamespace.dll) - Copy any third-party libraries that your project relies on (these should have been output to the build folder)
- Copy any other configuration files or resources that your project relies on.
- Do not copy any files that start with
Geocortex.Workflow.They are not required in this folder.
- Copy your project's assembly. (e.g.
note
If you created a .NET Core Project and see AssemblyNamespace.exe, you need to change the project output type to Class Library.
important
You may need to stop Geocortex Workflow Server in IIS in order to copy your copy your custom code.
Debugging Server Workflow Activities
You can debug custom Geocortex Workflow Server activities by attaching to the Geocortex Workflow Server process from the Geocortex Workflow extension project you created.
- Start Visual Studio 2019 with administrator privileges.
- Attach the debugger to the running
GeocortexWorkflowServer.exeprocess.- You may need to check 'show processes from all users' to see it.
- Set a breakpoint in your custom activity.
- Run your server workflow that uses the custom activity. Your breakpoint should be hit.
Automating Deployment of Server Workflow Activities
To automate the deployment to Geocortex Workflow Server, we have to add a post build step to the project that copies the build output.
- Locate the
Custom Assembliesfolder in the Geocortex Workflow Server installation. The default location isC:\Program Files\Latitude Geographics\Geocortex Workflow\CustomAssemblies - Create a file
excluded_files.txtat the root of the project that excludes the appropriate build output files as described in the deployment section.
- Edit the post build event in the project properties.
- Add a command which copies the build output to the
Custom Assembliesfolder. xcopy "$(OutDir)*" "C:\Program Files\Latitude Geographics\Geocortex Workflow\CustomAssemblies" /Exclude:$(ProjectDir)excludedFiles.txt /y
- Add a command which copies the build output to the
- Run a rebuild and ensure all appropriate files are copied.
important
You may need to stop then restart Geocortex Workflow Server in order for the post build step to copy your custom code.
Next Steps
Check out the tutorials to learn how to build custom activities for Geocortex Workflow Server and augment them with third party libraries.
Implement a Custom Activity
Implement a custom activity for Geocortex Workflow Server
Reference a Third Party Library
Reference a third party library in custom code.