Using the .NET Workflow SDK with VertiGIS Studio Workflow Server
VertiGIS Studio Workflow Server can be extended by augmenting your on-premises installation with additional custom .NET assemblies.
Requirements
Extending VertiGIS Studio Workflow Server requires administrative access to your on-premises installation of workflow.
Development Environment
Visual Studio 2022 is the only officially supported development environment for extending VertiGIS Studio Workflow Server.
Setting up a VertiGIS Studio Workflow Server Extension Project
Extending VertiGIS Studio Workflow Server requires you to produce a separate assembly with your custom activities, and copy that into your on-premises deployment of VertiGIS Studio Workflow. We first need to set up a project using Visual Studio that references the workflow runtime.
- Launch Microsoft Visual Studio 2022.
- Create a new project of type Class Library (.NET Standard)
- You can also create a project of type .NET 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 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
.csproj
file in a text editor and add theCopyLocalLockFileAssemblies
attribute to thePropertyGroup
.
<PropertyGroup>
<TargetFramework>netstandard2.1</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.
- Add a reference to the
VertiGIS.Workflow.Runtime
assembly. By default, this is located inC:\Program Files\VertiGIS\VertiGIS Studio Workflow\Deployment\service
.NET Standard projects must target .NET Standard 2.1, and .NET projects must target .NET 6.0, or else the assembly will be incompatible with VertiGIS Studio Workflow Server.
We recommend that you only implement the IActivityHandler
interface examples provided in the Developer Center. These examples have been verified and are provided to help you customize your VertiGIS Studio product to suit your needs. You should not reference other classes and functions from the various VertiGIS Studio Workflow assemblies. Doing so could risk breaking functionality and/or unexpected results as a result of future changes.
Next, learn how to implement a custom activity for VertiGIS Studio Workflow Server.
Deploying VertiGIS Studio Workflow Server Activities
For VertiGIS Studio 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
bin
folder. If you do not see abin
folder, it is possible you right-clicked on the solution instead of the project. - In the
bin
folder, open eitherDebug
orRelease
, depending on which build configuration you used. - In the
bin\Debug
orbin\Release
folder, there will be one final sub-directory which will benetstandard2.1
ornet6.0
. Open this folder. - You should now see a number of files including
VertiGIS.Workflow.Runtime.dll
and your own project, such asAssemblyNamespace.dll
.
- Find the
CustomAssemblies
folder on disk.- VertiGIS Studio Workflow looks in a folder called
CustomAssemblies
for assemblies that contain custom activities. This is located in the folder that you chose when installing VertiGIS Studio Workflow. The default location isC:\Program Files\VertiGIS\VertiGIS Studio Workflow\CustomAssemblies
- VertiGIS Studio Workflow looks in a folder called
- Copy the relevant files from the build output to the
CustomAssemblies
folder.- 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
VertiGIS.Workflow.
They are not required in this folder.
- Copy your project's assembly. (e.g.
If you created a .NET Project and see AssemblyNamespace.exe
, you need to change the project output type to Class Library
.
You may need to stop VertiGIS Studio Workflow Server in IIS in order to copy your copy your custom code.
Debugging Server Workflow Activities
You can debug custom VertiGIS Studio Workflow Server activities by attaching to the VertiGIS Studio Workflow Server process from the VertiGIS Studio Workflow extension project you created.
- Start Visual Studio 2022 with administrator privileges.
- Attach the debugger to the
w3wp.exe
process that is running as the VertiGISStudioWorkflow user.- You may need to check 'show processes from all users' to see it.
- If you have customized the application pool assigned to your installation of VertiGIS Studio Workflow, the username may be different.
- 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 VertiGIS Studio Workflow Server, we have to add a post build step to the project that copies the build output.
- Locate the
Custom Assemblies
folder in the VertiGIS Studio Workflow Server installation. The default location isC:\Program Files\VertiGIS\VertiGIS Studio Workflow\CustomAssemblies
- Create a file
excluded_files.txt
at the root of the project that excludes the appropriate build output files as described in the deployment section.
VertiGIS.Workflow.Runtime.dll
VertiGIS.Workflow.Runtime.xml
- 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\VertiGIS\VertiGIS Studio 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.
You may need to stop then restart VertiGIS Studio 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 VertiGIS Studio Workflow Server and augment them with third party libraries.
Implement a Custom Activity
Implement a custom activity for VertiGIS Studio Workflow Server
Reference a Third Party Library
Reference a third party library in custom code.