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.

  1. Launch Microsoft Visual Studio 2019.
  2. 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
  3. Edit the .csproj file in a text editor and add the CopyLocalLockFileAssemblies attribute to the PropertyGroup.
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>CustomWorkflow</RootNamespace>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
  • This will copy the referenced nuget assemblies to the build output folder, which will be important for later.
  1. Add a reference to the Geocortex.Workflow.Runtime assembly. 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.

  1. Build the project.
  2. Find the build output on disk.
    1. In Visual Studio, right-click on your project in Solution Explorer and choose "Open Folder in File Explorer".
    2. Open the bin folder. If you do not see abin folder, it is possible you right-clicked on the solution instead of the project.
    3. In the bin folder, open either Debug or Release, depending on which build configuration you used.
    4. In the bin\Debug or bin\Release folder, there will be one final sub-directory which will be netstandard2.0 or netcore2.1. Open this folder.
    5. You should now see a number of files including Geocortex.Workflow.Runtime.dll and your own project, such as AssemblyNamespace.dll.
  3. Find the CustomAssemblies folder on disk.
    1. Geocortex Workflow looks in a folder called CustomAssemblies for assemblies that contain custom activities. This is located in the folder that you chose when installing Geocortex Workflow. The default location is C:\Program Files\Latitude Geographics\Geocortex Workflow\CustomAssemblies
  4. Copy the relevant files from the build output to the CustomAssemblies folder.
    1. Copy your project's assembly. (e.g. AssemblyNamespace.dll)
    2. Copy any third-party libraries that your project relies on (these should have been output to the build folder)
    3. Copy any other configuration files or resources that your project relies on.
    4. Do not copy any files that start with Geocortex.Workflow. They are not required in this folder.
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.

  1. Start Visual Studio 2019 with administrator privileges.
  2. Attach the debugger to the running GeocortexWorkflowServer.exe process.
    • You may need to check 'show processes from all users' to see it.
  3. Set a breakpoint in your custom activity.
  4. 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.

  1. Locate the Custom Assemblies folder in the Geocortex Workflow Server installation. The default location is C:\Program Files\Latitude Geographics\Geocortex Workflow\CustomAssemblies
  2. Create a file excluded_files.txtat the root of the project that excludes the appropriate build output files as described in the deployment section.
Geocortex.Workflow.Runtime.dll
Geocortex.Workflow.Runtime.xml
  1. Edit the post build event in the project properties.
    • Add a command which copies the build output to the Custom Assemblies folder.
    • xcopy "$(OutDir)*" "C:\Program Files\Latitude Geographics\Geocortex Workflow\CustomAssemblies" /Exclude:$(ProjectDir)excludedFiles.txt /y
  2. 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.