Knowing Your Project Type
Right-click any of your projects and observe the context menu.
If you see a Publish option, your project is SDK-Style and you're in the right place. Continue on to learn how to build your package.


If you DO NOT see a Publish option, your project is Non-SDK-Style. See this page instead for instructions on building this type of project.


All projects created using v2.2.0+ of UiPath's Activity Creator will be SDK-Style. For more information on the two project types, see Microsoft's documentation here.
Building Your Package
Given that UiPath's platform is built on the .NET framework, all activities take the form of a Nuget package (this is the .nupkg file you get when downloading an activity directly from UiPath Connect! or from the feeds in UiPath Studio's package manager). Let's walk through the steps to build a .nupkg file and import it into UiPath Studio for use.
Get Process ID and Logs
Using methods applied to the IExecutorRuntime
reference, you can get information about the process ID which is being executed by the Robot, as well as execution logs. The following methods can be used:
IRunningJobInformation
- Collects information about the process which is being executed, and supports the following properties:JobID
- retrieves the process IDProcessName
- retrieves the process nameProcessVersion
- retrieves the process versionWorkflowFilePath
- retrieves the full path of the processFolderId
- retrieves the folder IDFolderName
- retrieves the folder nameTenantId
- retrieves the Orchestrator tenant IDTenantName
- retrieves the Orchestrator tenant nameRobotName
- retrieves the robot name
LogMessage
- Generates Robot Execution Logs according to a Logging Level you specify. Read more about logs on this page. The following properties are supported:EventType
- the logging level to retrieveMessage
- the message to display
The following code exemplifies the use of the LogMessage
method:
public class MyLogMessageActivity : CodeActivity
{
protected override void Execute(CodeActivityContext context)
{
var executorRuntime = context.GetExtension<IExecutorRuntime>();
var jobInfo = executorRuntime.RunningJobInformation;
executorRuntime.LogMessage(new LogMessage
{
EventType = TraceEventType.Warning,
Message = $"Job {jobInfo.JobId}: My log message from workflow {jobInfo.WorkflowFilePath}"
});
}
}
1) Build the Package
Within the Solution Explorer, right-click your Design project and select Publish. This option builds your projects, packages them together, and sends the package wherever you'd like.


In the next screen, enter the folder in which you'd like to save your activity package. It's a good idea to choose one of your package sources from UiPath Studio (you can find these at Settings > Manage Sources on the Studio homepage) so you can publish directly from Visual Studio into UiPath Studio.
Click Create Profile to continue.


On the next page, rename your package source to UiPath Packages (or whatever you'd like) and change the configuration to Debug. Then click Publish.
For more info on Debug vs Release configurations, see Package Metadata.


Your output will then show that all three projects have been built successfully and the resultant package published. You now have a working activity package!


2) Use Your Activities in UiPath Studio
Open UiPath Studio, navigate to the Package Manager, and add your activity set to workflow.


Notice that a new category has been added to the Activities pane.


That's all! Give your new activity a try!


Updated 7 months ago