Abonnieren

UiPath Developer

The UiPath Developer Guide

Building Activity Packages

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.

Prozess-ID und Protokolle abrufen

Mithilfe von Methoden, die auf die IExecutorRuntime-Referenz angewendet werden, können Sie Informationen über die Prozess-ID abrufen, die vom Roboter ausgeführt wird, sowie Ausführungsprotokolle. Es können die folgenden Methoden verwendet werden:

  • IRunningJobInformation – sammelt Informationen über den ausgeführten Prozess und unterstützt die folgenden Eigenschaften:
    • JobID – ruft die Prozess-ID ab
    • ProcessName – ruft den Prozessnamen ab
    • ProcessVersion – ruft die Prozessversion ab
    • WorkflowFilePath – ruft den vollständigen Pfad des Prozesses ab
    • FolderId - retrieves the folder ID
    • FolderName - retrieves the folder name
    • TenantId - retrieves the Orchestrator tenant ID
    • TenantName - retrieves the Orchestrator tenant name
    • RobotName - 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 – die abzurufende Protokollierungsebene
    • Message – die anzuzeigende Meldung

Der folgende Code veranschaulicht die Verwendung der LogMessage-Methode:

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!

Aktualisiert vor 6 Monaten


Building Activity Packages


Auf API-Referenzseiten sind Änderungsvorschläge beschränkt

Sie können nur Änderungen an dem Textkörperinhalt von Markdown, aber nicht an der API-Spezifikation vorschlagen.