How to execute your custom code in a workflow
UiPath Studio comes with multiple activity packs that cover all most used actions you need to develop a workflow that implements a complex business process. But there are times where you would need to plug in your own code or define custom types that are not available in the .NET Framework. This article's scope is to showcase how you can achieve this in UiPath Studio.
So lets say that you have created your own assembly that contains an object called GenericException that defines a custom exception type and you would like to use it in your workflow.
To do that you need to create a NuGet pack that contains your assembly and all its dependencies, and afterwards plug it in UiPath Studio. The easiest way to create a NuGet pack is by using NuGet Package Explorer.
- Open NuGet Package Explorer
- Click Create a new package
- Right click in the Package contents and select Add Lib Folder.
- Right click on the Lib Folder->Add Existing File and choose your assembly file and all its dependecies
- Click Edit->Metadata. Set an Id for your package, an Author and a Description.
- Click File->Save and save your package in Packages folder available next to UiStudio.exe
After you have created your package and placed it in Packages folder, all you have to do is open UiPath Studio, go to Manage Packages and Install it.