订阅

UiPath Studio

UiPath Studio 指南

关于自动化项目

UiPath Studio 支持您创建以下类型的项目:

  • “流程”- 设计并发布自动化流程,以便机器人可以执行该流程。
  • Library - Design workflows as reusable components and publish the project as a library that can be added as a dependency to multiple processes. For more information, see About Libraries.
  • Test Automation - Design a test automation project. For more information about test automation, see the Test Suite section.
  • Template - Design a process and publish it as a template that other processes which share common characteristics can then be based on. For more information, see Project Templates.

要创建新的空白项目,请转到“主页”(Studio 后台视图)>“开始”,然后在“新建项目”下选择要创建的项目类型。或者,您可以从“从模板新建”下的其中一个默认模板开始,或转到“模板”选项卡以浏览来源多样的更多模板。

563563

在新项目窗口中,为每个项目配置以下内容:

  • 为新项目输入名称(最多 128 个字符)和描述,以概括您打算如何使用此自动化项目(最多 500 个字符)。
  • 选择创建项目的位置。创建项目的默认位置为 %USERPROFILE%\Documents\UiPath
  • Select the compatibility and language.
    :information-source: Note: The compatibility and language cannot be changed after you create a project.

默认情况下,项目文件夹包含以下文件和子文件夹:

  • Files
    • Main.xaml - Created by default to hold your main workflow. In addition, all the other automation XAML files you add to the project are stored in the project folder. Optionally, you can set a different file as main. All the files must be linked through the Invoke Workflow File activity to the file set as main or to a file marked as an entry point to the project. For test automation projects, a TestCase.xaml file is created by default instead of Main.xaml.
    • project.json - 包含有关自动化项目的信息。
  • Subfolders
    • .entities - 如果项目中使用了实体,则包含有关从 Data Service 导入的实体的数据。
    • .local - 包含为项目在本地缓存的数据。
      :information-source: Note: The .local folder is hidden. You can enable viewing hidden items from the Windows File Explorer settings.
    • .objects - 如果项目中使用了添加到对象存储库的任何项目,则包含与此等项目相关的数据。
    • .screenshots - 如果在项目中使用了任何用户界面自动化活动,则包含在此等活动中生成的参考截图。
    • .settings - 包含运行时使用的活动项目设置。
    • .templates - 包含添加到项目中的文件模板。
    • .tmh -如果在项目中使用了任何测试用例,则包含与此等用例相关的数据。

📘

重要提示:

使用新版 Studio 创建的项目可能不适用于旧版 Studio。详情请参阅向后和向前兼容性

设置项目兼容性

在 Studio 配置文件中创建新项目时,请根据要执行项目的环境选择兼容性:

  • “Windows - 旧版”- 使用 .NET Framework 4.6.1。在 2021.10 之前的版本中使用的兼容性。这是默认选项。
  • Windows - Uses .NET 6 (in Studio 2021.10.6 and later versions) or .NET 5 (in Studio 2021.10 versions prior to 2021.10.6) with Windows support.
  • Cross-platform - Uses .NET 6 (in Studio 2021.10.6 and later versions) or .NET 5 (in Studio 2021.10 versions prior to 2021.10.6) with cross-platform support.

🚧

重要

Windows and Cross-platform processes require Orchestrator 2021.10 and newer to run.

要了解兼容性之间的区别,请参阅下表。

Windows - LegacyWindowsCross-platform
Process execution32-bit64-bit64-bit
Supported platforms for executionWindows (32-bit and 64-bit)Windows (64-bit)Windows and Linux (64-bit)
Processes are compiled when publishedNo. Published packages contain the project source files.Yes. Published packages contain compiled DLL files.Yes. Published packages contain compiled DLL files.

The design experience is the same for all compatibilities, but only the activities packages that support the selected compatibility can be installed from the package manager.

每个项目的兼容性显示在 Studio 状态栏的右侧和“项目”面板>“依赖项”节点中。在“主页”(Studio 后台视图)>“开始”选项卡的“打开最近的项目”列表中,每个项目的条目中也会显示兼容性。

设计跨平台项目

跨平台项目可用于创建基于 API 的自动化,这些自动化可在 Windows 以及类 Unix 操作系统上执行。

📘

备注:

在 2021.10 版本中,跨平台项目仅支持在 Windows 和 Linux 上执行。

要创建具有跨平台支持的无人值守项目,请执行以下操作:

  1. 在 Studio 中创建一个新项目,然后选择“跨平台”兼容性选项。此选项适用于所有项目类型。
  2. 设计自动化。请注意,并非所有活动包都与跨平台项目兼容,因此包管理器中仅提供有限的包选择。跨平台项目的默认依赖项包括 UiPath.System.ActivitiesUiPath.WebApi.Activities
  3. 测试自动化。我们建议使用远程调试在将运行自动化的计算机上测试自动化程序,该调试程序同时适用于 Windows 和 Linux 机器人
  4. 在测试完自动化后,请将项目发布到 Orchestrator。Windows 和 Linux 运行无人值守作业的过程相同。

设置项目语言

在 Studio 配置文件中创建新项目时,您可以选择用于表达式的语言(VB 或 C#)。VB 是默认选择的语言,但您可以转到“主页”(Studio 后台视图)>“设置”>“设计”,将 C# 设置为新项目的默认语言。在 StudioX 配置文件中创建的项目使用 VB.NET 语言编写表达式。

不支持在同一项目中同时使用 VB 和 C# 表达式。无法在 C# 工作流中使用 VB 表达式,反之亦然。在复制其他项目中的活动、调用或导入工作流时,请确保其使用的语言与目标项目相同。

您可以将 C# 库安装为 VB 项目中的依赖项,反之亦然。但是,无法从安装库的项目访问使用语言特定的表达式为库项目中的参数定义的默认值。

C# 局限性

  • 当前的 C# 实现基于使用 C# 版本 5 的 C# 编译器,因此限制了对诸如合并分配、null 条件运算符、null 合并运算符、字符串插补等新功能的访问。
  • 包含带增量表达式的项目无效。
  • 包含 nameof() 运算符的表达式被标记为无效,并且当前 C# 实现中不允许使用。
  • 包含对带可选参数方法的调用的表达式必须包含可选参数的值。
  • 与 VB.NET 相比,C# 项目的设计时间和运行时性能较低。当运行时性能至关重要时,我们建议使用 VB.NET 而不是 C#。

设置项目版本

语义版本控制

语义版本控制方案采用 Major.Minor.Patch[-Suffix] 格式,其中:

  • Major 是主要版本。
  • Minor 是次要版本。
  • Patch 是补丁版本。
  • -Suffix(可选)是连字符加一串句点分隔的标识符,紧接在补丁版本后。这表示预发行版本。

标识符必须仅由 ASCII 字母数字和连字符组成,并且不得为空。数字标识符不得以零开头。此外,内部版本元数据必须通过以下方式表示:附加一个加号及一串以句点分隔的标识符,紧接在补丁版本或预发行版本后面,例如 1.0.0-alpha+1。

在新建流程或库时,默认版本方案是语义版本。可以从“发布”窗口中更改,只需在版本号中添加额外一位数字即可。项目的语义版本可也从 project.json 文件修改。版本号为 major.minor 的项目将自动添加补丁编号 0。

传统版本控制

为项目生成的传统版本号采用 M.m.bbbb.rrrrr 格式,其中:

  • M 表示主要版本。
  • m 表示次要版本。
  • bbbb 表示内部版本。
  • rrrrr 表示修订版本。

也可以在 project.json 文件中编辑主要版本和次要版本,而内部版本和修订版本是根据某种算法生成 - 内部版本值是指自 01.01.2000 以来经过的天数。修订值是当天至发布时所经过的秒数。其结果除以 2,使得最大的修订编号不会超过 65535。

“发布”窗口中的建议版本号基于项目的以往版本控制方案生成,对于采用 4 位数版本控制方案的项目则考虑使用当前的日期和时间戳。

管理项目

393393

“项目”面板可用于查看当前项目的内容,添加文件夹,打开文件位置,管理依赖项,以及调整项目设置。

14441444

将文件资源管理器中的文件直接复制并粘贴到“项目”面板。您还可使用拖放功能对一个或多个文件执行相同操作,包括 .xaml 工作流。您还可以使用 Ctrl + CCtrl + V 快捷键或上下文菜单中的“复制”和“粘贴”选项来复制面板内的文件或文件夹。

OptionDescription
Expand Allexpand_allexpand_allExpands all nodes in the automation project.
Collapse Allcollapse_allcollapse_allCollapses all nodes in the automation project.
RefreshrefreshrefreshRefreshes the project.
Show All Filesshow_filesshow_filesShows all files belonging to the automation project, including the project.json.
File Explorerfile_explorerfile_explorerOpens the project's location on the machine.
Project Settingsproject_settingsproject_settingsOpens the Project Settings window for processes or libraries.

项目的上下文菜单

右键单击“项目”面板中的任意位置以打开上下文菜单,其中包含下表中所述的选项。选项的不同子集是否可用,取决于您在面板中的右键单击位置、项目类型以及是否将项目添加到来源控件。

OptionDescription
Open Project FolderOpens the local folder containing the project.
Project SettingsOpens the Project Settings window for adjusting project preferences.
AddOpens a list of items that can be added to the project: folder, sequence, flowchart, state machine, global handler, workflow, or, in test automation projects, test case.
Import WorkflowsImports .xaml files to the project and adds Imported in the file name if it coincides with the name of the main file.
Import FilesOpens the File Explorer window for importing various files into your project.
Add to Source ControlAdds the current project to source control using Git Init, Copy to Git, Add to TFS, or Add to SVN options. Please note that this option is only visible when right-clicking the project node.
When a project is added to source control, additional options are available in the context menu. See the options for GIT and the options for SVN and TFS.
OpenOpens the selected files using the default program.
Open File LocationOpens the local folder containing the file.
RenameEnables you to rename the selected file or folder, and opens the Rename Item window. The item is renamed in all occurrences.
CopyCopies the selected files or folders to the clipboard. You can then paste them in the project panel or in the Windows file explorer.
PastePastes files or folders that were copied to the clipboard.
DeleteDeletes the selected item only from your local machine.
Select for CompareSelects the current file for comparison.
Compare with SelectedCompares the current file with the previously selected file using Compare Files.
Find ReferencesFinds all references to the file in the project. The results are displayed in the Find References panel.
Debug FileDebugs the selected .xaml file.
Set as MainSets the selected .xaml file as Main in the project definition, meaning that the project execution starts with that file. There can only be one Main project file. The name of the file set as main appears in bold in the Project panel.
PropertiesOpen the library’s Properties window for adding a tooltip and Help Link.
Set as Global HandlerSets the .xaml file as the Global Exception Handler for the project. This is applicable to one workflow per project/process.
Remove HandlerRemoves the Global Exception Handler tag from the .xaml file.
Enable Entry PointMarks the selected workflow file as an entry point for the process, making it possible to select it as the workflow to run first when using the Invoke Process and Run Parallel Process activities in other processes, or when starting a job from Orchestrator.
Notes:
When a file is marked as an entry point, an arrow is displayed on the icon next to the file name icon_enable_entry_pointicon_enable_entry_point.
Enabling a file that is ignored from publishing as an entry point sets the file as publishable.
This option is not available for test case files.
This option is not available in library projects.
Disable Entry PointNo longer marks the selected workflow file as an entry point for the process. This option is not available for the workflow file that is set as Main.
Extract as TemplateSaves the selected workflow or test case as a template on which you can then base other files in the project. Using a file template allows you to save time when you need to create multiple files with the same structure. When you add a new workflow or test case, you have the option to base it on any template of the same type that exists in the Templates project folder.
Ignore from Publish / Set as PublishableMarks one or more selected files as excluded from publishing or publishable.
Notes:
When a file is ignored from publishing, the icon next to the file name turns gray icon_ignore_publishicon_ignore_publish.
Ignoring a file marked as an entry point from publishing disables the entry point.
These options are not available for workflow files in library projects.
In projects where XAML files are compiled when published, workflow and test case files that are excluded from publishing are not compiled.
Make Private / Make PublicMarks one or more selected files in a library project as private or public, A private workflow file is included in the published package, but no reusable component is created and made available in the Activities panel in projects where the library is installed as a dependency.
Notes:
When a file is marked as private, the icon next to the file name turns gray icon_ignore_publishicon_ignore_publish.
These options are not available for test case files.
Create Test CaseCreates a test case that invokes the selected workflow file.
Convert to Test Case / Convert to WorkflowConverts the selected workflows to test cases or the selected test cases to workflows.
Import Test CasesImports test cases into the project as draft test cases.
Add Test DataOpens the Import Data Variation Source window that enables you to add test data to the project. This option is only available for test cases.
Link to Test ManagerOpens the Link to Test Manager window that enables you to link the selected test cases to Test Manager.
Run Test Cases / Debug Test CasesRuns or debugs multiple selected test cases.

GIT 的上下文菜单选项

在添加到 GIT 存储库的项目中,“项目”面板中的每个文件旁边都会显示一个图标,以指示文件状态:
git branchgit branch The file is synced with the repository.
git editedgit edited The file has been modified.
source control addedsource control added The file has been added.

Right-click a file or project node in the Project panel to open the GIT-specific context menu for Managing Projects with GIT.

234234
OptionDescription
CommitCommits current changes to the local GIT repository.
PushPushes the current version onto the remote repository.
Pull (rebase)Pulls remote files and rebases the current branch.
Manage BranchesOpens the GIT window with options for managing currently added branches.
Show ChangesOpens the File Diff window for comparing changes between the local version and the remote version of the file.
Show HistoryOpens the Show History window for comparing two versions of the same file.
UndoOpens the Undo Pending Changes window if the file was not committed or pushed to the remote repository.
Copy Repository URLCopies the repository URL of the project to the clipboard.

SVN 和 TFS 的上下文菜单选项

在添加到 SVN 或 TFS 存储库的项目中,“项目”面板中的每个文件旁边都会显示一个图标,以指示文件状态:
svn lockedsvn locked The file is not checked out for editing.
svn checked outsvn checked out The file has been checked out for editing.
svn editedsvn edited The file has been edited.
source control addedsource control added The file has been added.

Right-click a file or project node in the Project panel to open the context menu with options specific to managing projects with TFS or SVN.

233233
OptionDescription
Open Opens the selected .xaml file in the Designer panel, in read-only mode if it was not checked out for edit from the TFS/SVN repository.
Rename Enables you to rename the selected file or folder, and opens the Rename Item window. When checking in the renamed .xaml file, the previously modified version must also be checked in.
Delete Deletes the selected item only from your local machine. The latest checked in version of the file is still available in the TFS/SVN repository.
Check Out For EditMarks the selected file or folder as locked for editing. Checking out a file locks it on the server so that no one else can edit it.
Finish EditingChecks in the project.json file in the respository, together with changes and a commit message.
Add Uploads the selected item to the TFS/SVN server. This option is not available, if the item was previously uploaded to the server.
Get Latest Version Downloads the latest version of the selected item from the TFS/SVN repository.
Show changes...Opens the File Diff to compare changes between the versioned file and the one mapped locally.
Check In Displays the Check In Changes window and enables you to upload the selected item to the server as the newest version. The .xaml file must be saved before uploading it. After it’s checked in, the file becomes read-only in Studio.
Undo Displays the Undo Pending Changes window and enables you to Revert the changes done to the project, either revert modified files to previous or unversioned states, or retrieve files which were deleted from the local machine.

Changes cannot be reverted after the file was checked in.
RunRuns the selected workflow, even if it's not checked out or added to the repository.
Set as MainSets the selected .xaml file as Main in the project. The first created .xaml is set as Main by default.
Copy Repository URLCopies the repository URL of the project to the clipboard.

调整项目设置

A set of individual settings can be established for each automation project that you’re working on. Such settings are available in the Project Settings window, which can be opened by clicking the settings_iconsettings_icon in the Project panel.

875875

设置窗口字段说明

The following table describes the project settings for process, test automation, and template projects. For information about the settings available for libraries, see About Libraries.

FieldDescription
NameChange the name of the project. Such names may contain whitespace characters. When naming projects, keep in mind that whitespace characters are removed at publish time. This field accepts up to 128 characters.
DescriptionChange the project description. This field accepts up to 500 characters.
Automation Hub URLURL of an Automation Hub idea linked to the project. For more information, see Linking a Project to an Idea in Automation Hub.
Package IconOptionally, define a custom icon for the project. You can browse to and select a file, or enter a path or public URL to an ico, jpeg, jpg, or png file up to 1MB in size.

After the project is published, the icon is displayed as follows:
For processes, in the Assistant next to the process name, making it easier to identify it in the list of processes.
For templates, next to the template in Home (Studio Backstage View) > Templates.
For libraries, next to the package in the Manage Packages window in Studio.
:information-source: The icon is not visible in Manage Packages if a local file is used for a library published to Orchestrator or a feed that does not support embedded icons, In this case, specify the icon using a URL.
Disable PauseEnable or prevent users from pausing execution from the UiPath Assistant. Set to Yes if pausing the process during execution would result in crashing it. For example, if an activity in your workflow uses the Timeout property, pausing the execution might cause the timeout to expire, thus breaking the execution.
Attended AutomationSet to Yes to indicate that the project should only be executed in an attended context. Use this setting for projects that include UI Automation activities or other activities that require user interaction.
Starts in BackgroundSet to Yes to turn the project into a Background Process and allow it to run in the background concurrently with other processes, as long as it does not use UI interaction.
Supports PersistenceSet to Yes to turn the project into an Orchestration Process.
PiP Ready Set to Yes to indicate that the project was tested using Picture in Picture. If set to No, when the process is run in PiP from the Assistant, a dialog informs the user it was not tested using this feature and prompts for confirmation before proceeding.
Starts in PiP Set to Yes to indicate that the process should be run by default using the Picture in Picture feature.
Modern Design Experience Set to Yes to enable a modern experience of working with UI Automation, including new and improved activities, recorders, and wizards, as well as the Object Repository.
This setting also enables / disables a modern design experience for Excel if the Excel Design Experience option is set to UseGlobalSetting in the Excel activities project settings.

单击“确定”,所做的更改即可在“项目”面板和 project.json 文件中查看。

Check out the Configuring Activity Project Settings page to read about how to adjust activity properties at project level.

📘

备注:

请注意,每当要将一个序列中的大量活动复制到另一个序列时,我们均建议您事先向下滚动到“设计器”面板底部。这是因为 Windows Workflow Foundation 限制的关系。

删除未使用的项目资源

不必要的资源会使项目更难以理解并影响性能。为避免此问题,请通过单击 Studio 功能区中的“删除未使用的资源”,选择要删除的内容,以从项目中删除未使用的资源:

  • 工作流 - 删除项目中未引用的工作流文件。
  • 变量 - 删除当前已打开文件中未使用的变量。
  • 参数 - 删除当前已打开文件中未使用的参数。
  • 依赖项 - 删除项目中未使用任何活动的已安装活动程序包。
  • 导入 - 删除当前已打开文件中未使用的已导入命名空间。
  • 屏幕截图 - 删除项目中任何活动未使用的信息截图。

6个月前更新


关于自动化项目


建议的编辑仅限用于 API 参考页面

您只能建议对 Markdown 正文内容进行编辑,而不能建议对 API 规范进行编辑。