UiPath Documentation
studio
2020.10
false
Studio 用户指南
重要 :
新发布内容的本地化可能需要 1-2 周的时间才能完成。

关于自动化项目

UiPath Studio allows you to create two types of standalone automation projects: process or library. Processes can incorporate all types of workflows, sequence, flowchart, state machine and global exception handler, while the global exception handler isn't available for libraries. Moreover, libraries can be added as dependencies to automation processes.

在 Studio 中启动新流程时,将在选定位置中使用自定义名称创建一个文件夹。项目默认保存在 %USERPROFILE%\Documents\UiPath 目录中,除非手动更改此位置。

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

  • 文件
    • 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. In the case of test projects created in Studio Pro, a TestCase.xaml file is created by default instead of Main.xaml.
    • project.json - 包含有关自动化项目的信息。
  • 子文件夹
    • .entities - 如果项目中使用了实体,则包含有关从 Data Service 导入的实体的数据。

    • .local - 包含为项目在本地缓存的数据。

    • .objects - 如果项目中使用了添加到对象存储库的任何项目,则包含与此等项目相关的数据。

    • .screenshots - 如果在项目中使用了任何用户界面自动化活动,则包含在此等活动中生成的参考截图。

    • .settings - 包含运行时使用的活动项目设置。

    • .tmh -如果在项目中使用了任何测试用例,则包含与此等用例相关的数据。

      备注:

      使用较新版本 Studio 创建的项目可能无法与较旧 Studio 版本一起使用。阅读有关向后和向前兼容性的更多信息。

      不能在文件名中使用以下字符:", <, >, |, :, *, ?, \, /,;。这些字符来自 Microsoft Windows 限制其他特殊字符限制

设置项目语言

在 Studio 和 StudioX 配置文件中创建的项目使用 VB.NET 语言编写表达式。

在 Studio Pro 配置文件中,当您创建新项目时,可以选择 VB 或 C#。VB 是默认选择的语言,但您可以转到“主页”(Studio 后台视图)>“设置”>“设计”,将 C# 设置为新项目的默认语言。请注意,只能以 Studio Pro 配置文件打开 C# 项目。

不支持在同一项目中同时使用 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 位数版本控制方案的项目则考虑使用当前的日期和时间戳。

管理项目

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

将文件资源管理器中的文件直接复制并粘贴到“项目”面板。您还可使用拖放功能对一个或多个文件执行相同操作,包括 .xaml 工作流。使用 Ctrl + CCtrl + V 快捷方式,您还可以复制文件并在树中的任意位置复制它。

选项 描述

全部展开docs image

展开自动化项目中的所有节点。

全部折叠docs image

折叠自动化项目中的所有节点。

刷新docs image

刷新项目。

显示所有文件docs image

显示从属于自动化项目的所有文件,包括 project.json

文件资源管理器docs image

打开项目在计算机上的位置。

项目设置docs image

打开流程或库的“项目设置”窗口。

删除未使用的屏幕截图docs image

删除运行自动化项目时未使用的屏幕截图。

项目的上下文菜单

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

选项 描述

打开项目文件夹

打开包含项目的本地文件夹。

项目设置

打开用于调整屏幕首选项的“项目设置”窗口。

添加

Opens a list of items that can be added to the project: folder, sequence, flowchart, state machine or global handler.

导入工作流

.xaml 文件导入到项目中,如果文件名与主文件的名称一致,则会在文件名中添加“导入”。

导入文件

打开文件资源管理器窗口,将各种文件导入项目。

添加到来源控件

Adds 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.

打开

使用默认程序打开所选文件。

打开文件位置

打开包含该文件的本地文件夹。

重命名

用于重命名选定的文件或文件夹,并打开“重命名项目”窗口。系统随即会在此项目出现的所有位置处将其重命名。

删除

仅会从本地计算机中删除选定的项目。

选择进行比较

选择当前文件以进行比较。

与选定项比较

Compares the current file with the previously selected file using Compare Files.

查找引用

Finds all references to the file in the project. The results are displayed in the Find References panel.

调试文件

调试所选的 .xaml 文件。

设置为“主要”

在项目定义中将选定的 .xaml 文件设置为“主要”,这意味着项目执行从该文件开始。只能有一个项目文件。设置为主文件的文件名称将在“项目”面板中以粗体显示。

属性

打开库的“属性”窗口,以添加工具提示和“帮助链接”。

设置为全局处理程序

.xaml 文件设置为项目的“全局异常处理程序”。这适用于每个项目/流程的工作流。

删除处理程序

.xaml 文件中删除“全局异常处理程序”标签。

启用入口点

Marks 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.

  • When a file is marked as an entry point, an arrow is displayed on the icon next to the file name docs image.
  • 启用从发布中被忽略的文件作为入口点,将文件设置为可发布。
  • 此选项不适用于测试用例文件。
  • 此选项在库项目中不可用。

禁用入口点

不再将选定的工作流文件标记为流程的入口点。此选项不适用于设置为“主要”的工作流文件。

从发布中忽略

将一个或多个选定文件标记为从发布中排除。

  • When a file is ignored from publishing, the icon next to the file name turns gray docs image.
  • 如果从发布中忽略标记为入口点的文件,将禁用入口点。
  • In a library project, a file that is ignored from publishing is included in the package, but no reusable component is created and made available in the Activities panel in projects where the library is installed as a dependency.

设为可发布

将一个或多个选定的从发布中排除的文件标记为可发布。

GIT 的上下文菜单选项

在添加到 GIT 存储库的项目中,“项目”面板中的每个文件旁边都会显示一个图标,以指示文件状态:

文档图像 该文件与存储库同步。

文档图像 该文件已被修改。

文档图像 已添加该文件。

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

选项描述
提交将当前更改提交到本地 GIT 存储库。
推送将当前版本推送到远程存储库。
拉取(重定基准)拉取远程文件,并为当前分支重定基准。
管理分支打开“GIT”窗口,其中含有管理当前添加的分支的选项。
显示更改打开“文件区别”窗口,以比较文件的本地版本和远程版本相比的更改。
显示历史打开“显示历史”窗口,以比较同一文件的两个版本。
撤消如果文件未提交或推送到远程存储库,则打开“撤消待定更改”窗口。
SVN 和 TFS 的上下文菜单选项

在添加到 SVN 或 TFS 存储库的项目中,“项目”面板中的每个文件旁边都会显示一个图标,以指示文件状态:

文档图像 该文件未签出以进行编辑。

文档图像 该文件已签出进行编辑。

文档图像 该文件已被编辑。

文档图像 已添加该文件。

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.

选项描述
打开如果没有从 TFS/SVN 存储库签出所选 .xaml 文件进行编辑,请在“设计器”面板中以只读模式打开所选 .xaml 文件。
重命名用于重命名选定的文件或文件夹,并打开“重命名项目”窗口。在签入重命名 .xaml 文件后,还必须签入先前修改的版本。
删除仅会从本地计算机中删除选定的项目。文件的最新签入版本在 TFS/SVN 存储库中仍然可用。
签出以进行编辑将选定的文件或文件夹标记为锁定以进行编辑。签出某个文件会在服务器上锁定此文件,这样其他人就无法编辑此文件。
完成编辑签入存储库中的 project.json 文件,包括变更和提交消息。
添加将选定项目上传到 TFS/SVN 服务器。如果项目先前已上传到服务器,则此选项不可用。
获取最新版本从 TFS/SVN 存储库下载所选项的最新版本。
显示更改...打开“文件区别”,以比较版本化文件和本地映射文件之间的更改。
签入显示“签入更改”窗口,用于将选定的项目作为最新版本上载到服务器。必须首先保存 .xaml 文件,然后才能将其上传。签入后,文件在 Studio 中变为只读。
撤消显示“撤消待定更改”窗口,并用于还原已对项目所做的更改:或者将已修改的文件还原为先前状态或无版本控制状态,或者检索已从本地计算机中删除的文件。

在签入文件后,无法恢复更改
运行运行所选工作流,即使它没有签出或没有添加到存储库。
设置为“主要”在项目中,将选定的 .xaml 文件设置为“主要”。默认情况下,第一个创建的 .xaml 被设置为“主要”。

调整项目设置

您可为处理的每个自动化项目建立一组单独的设置。此类设置位于“项目设置”窗口中,可通过单击文档图像“项目”面板中。

设置窗口字段说明
字段描述
名称更改项目名称。此类名称可能包含空格字符。在命名项目时,请记住在发布时删除空格字符。该字段最多接受使用 128 个字符。
描述更改项目说明。该字段最多接受使用 500 个字符。
禁用暂停启用或阻止用户暂停机器人托盘中的流程。如果在执行期间暂停流程可导致其崩溃,此开关应设为“是”。例如,如果工作流中的某一活动使用了 Timeout 属性,暂停执行可能会导致超时过期,因而破坏执行。
在后台启动Set to Yes to turn the project in a Background Process and allow it to run in the background concurrently with other processes, as long as it does not use UI interaction.
支持暂留Set to Yes to turn the project in an Orchestration Process.
PiP 已就绪Set to Yes to indicate that the project was tested using Picture in Picture. If set to No, the option to use this feature is not available for the process.
在 PiP 中启动设置为“是”表示默认情况下应使用“画中画”功能运行该流程。
新式设计体验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.

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

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

备注:

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

关于 Project.Json 文件

Project.json 是针对每个 .xaml 文件自动生成的文件,在项目文件夹中标记为“主要”

The file holds varied information, including project dependencies, or web services loaded in libraries. For more information about web services in libraries, check out the Loading Web Services in Libraries page.

备注:

Manually editing the project.json file should be attempted for troubleshooting scenarios only, as it may lead to severe consequences and loss of support. As of 2018.2, you should specify a project.json file when running your project from the UiRobot.exe (command line) client.

下表介绍了 Project.json 文件中包含的参数。

参数 描述

name

自动化项目的标题。其在 Studio 中创建新流程或库时提供。

description

项目的描述。在创建新项目时,将在 Studio 中的“描述”字段中提供描述。

main

自动化项目的入口点。其包含 .xaml 文件。默认名称为“Main.xaml”。它既显示为“设计器”面板的标题,也显示在 Studio 中的“属性”面板中。如果希望首先执行不同的项目,请将此参数的值更改为要处理的 .xaml 文件的名称。

If your automation project contains multiple files, each of them should be linked to the Main.xaml file through the Invoke Workflow File activity. This is especially useful when the project is published to Orchestrator and sent to a Robot, as the Robot executes only the file provided in this parameter.

dependencies

用于创建自动化项目及其版本的活动包。每当从项目中添加或删除依赖项时,或包版本更改时,该列表都会更新。

版本号由以下部分组成,按顺序排列:主版本号、次版本号、内部版本号和修订版本号。构建值是自 01.01.2000 以来经过的天数。 修订值是从格林尼治标准时间上午 5 点开始的,发布当天经过的秒数。

webServices

  • namespace -“添加新服务”窗口中为库提供的服务名称。
  • serviceDocument - 包含 SOAP 或 Swagger 服务元数据的 .xml.json 文件的路径。该文件在修复服务时使用,并且应作为项目的一部分进行版本控制。
  • webDocumentUri - Swagger 或 SOAP 资源的文件路径或链接(在“添加新服务”窗口中创建服务时提供)。
  • uniqueReference - 服务版本控制需要的参考。

entitiesStores

  • serviceDocument - 本地实体文件的路径。
  • tenantName - Data Service 所在的租户。
  • namespace - 实体在其下导入的命名空间(项目命名空间)。
  • uniqueReference - 服务版本控制需要的参考。

schemaVersion

project.json 文件的版本。

studioVersion

用于创建自动化项目的 Studio 版本。

projectVersion

将此项目发布到订阅源时使用的版本。表示“发布”窗口中设置的版本。

runtimeOptions

  • isPausable - 是否为流程启用暂停
  • requiresUserInteraction - 流程是否是长时间运行的流程。
  • supportsPersistence - 流程是否支持持久性,
  • excludedLoggedData - Contains keywords that can be added to the name of an activity to prevent variable and argument values from being logged at the Verbose level. That can also be achieved by selecting the Private checkbox of any activity. Read more about the protection of sensitive information here.
  • readyForPiP - 流程是否标记为“PiP 已就绪”。
  • startsInPiP - 是否将流程配置为在 PiP 中启动。

designOptions

  • projectProfile - 创建项目(业务 (StudioX) 或开发)时使用的 Studio 配置文件。
  • outputType 显示项目类型:流程测试
  • libraryOptions

    • includeOriginalXaml - 是否在结果 .nupkg 文件中包括原始工作流文件。
    • privateWorkflows - 库中包含的私有 .xaml 文件的完整名称。
  • processOptions

    • ignoredFiles - 从发布中忽略的 RPA 工作流文件列表。
  • fileInfoCollection - 包含流程中每个测试用例文件的以下信息:editingStatus(“可发布”或“正在进行”)、testCaseIdfileName
  • modernBehavior - 是否将流程配置为使用新式设计体验。

arguments

包含在设置为“主要”的工作流文件中定义的每个 inputoutput 参数的以下信息:nametype,无论是否为 required,以及它是否具有默认值 (hasDefault)。

参数信息仅在发布后添加到 .nupkg 包的文件中。

expressionLanguage

为流程设置的语言(VisualBasic 或 CSharp)。

entryPoints

包含标记为流程入口点的每个文件 filePath

uniqueId 的以下信息;以及文件中每个 inputoutput 参数的以下信息:nametype,是否为 required,是否具有默认值 (hasDefault)。

参数信息仅在发布后添加到 .nupkg 包的文件中。

isTemplate

项目是否为模板。

templateProjectData

包含模板项目的以下信息:

  • defaultProjectDescription - 基于模板的流程的默认项目描述。
  • defaultProjectName - 基于模板的流程的默认项目名称。

以下是通过 Studio 发布的包中包含的 project.json 文件内容的示例。

{
  "name": "UI-40028",
  "description": "Blank Process",
  "main": "Flowchart.xaml",
  "dependencies": {
    "UiPath.Excel.Activities": "[2.9.3]",
    "UiPath.Mail.Activities": "[1.9.3]",
    "UiPath.System.Activities": "[20.10.1]",
    "UiPath.UIAutomation.Activities": "[20.10.6]"
  },
  "webServices": [],
  "entitiesStores": [],
  "schemaVersion": "4.0",
  "studioVersion": "20.10.2.0",
  "projectVersion": "1.0.1",
  "runtimeOptions": {
    "autoDispose": false,
    "isPausable": true,
    "requiresUserInteraction": true,
    "supportsPersistence": false,
    "excludedLoggedData": [
      "Private:*",
      "<em>password</em>"
    ],
    "executionType": "Workflow",
    "readyForPiP": false,
    "startsInPiP": false
  },
  "designOptions": {
    "projectProfile": "Developement",
    "outputType": "Process",
    "libraryOptions": {
      "includeOriginalXaml": false,
      "privateWorkflows": []
    },
    "processOptions": {
      "ignoredFiles": []
    },
    "fileInfoCollection": [],
    "modernBehavior": false
  },
  "arguments": {
    "input": [
      {
        "name": "argument1",
        "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
        "required": false,
        "hasDefault": false
      },
      {
        "name": "argument2",
        "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
        "required": false,
        "hasDefault": false
      }
    ],
    "output": []
  },
  "expressionLanguage": "VisualBasic",
  "entryPoints": [
    {
      "filePath": "Main.xaml",
      "uniqueId": "5289efb0-f8bc-42f3-8cf4-0caa3a7d1915",
      "input": [
        {
          "name": "argument1",
          "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "required": false,
          "hasDefault": false
        },
        {
          "name": "argument2",
          "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "required": false,
          "hasDefault": false
        }
      ],
      "output": []
    },
    {
      "filePath": "Flowchart.xaml",
      "uniqueId": "d0904ba0-506e-437d-979c-b9da4325faad",
      "input": [
        {
          "name": "argument1",
          "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "required": false,
          "hasDefault": false
        },
        {
          "name": "argument2",
          "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "required": false,
          "hasDefault": false
        }
      ],
      "output": []
    }
  ],
  "isTemplate": false,
  "templateProjectData": {},
  "publishData": {}
}
{
  "name": "UI-40028",
  "description": "Blank Process",
  "main": "Flowchart.xaml",
  "dependencies": {
    "UiPath.Excel.Activities": "[2.9.3]",
    "UiPath.Mail.Activities": "[1.9.3]",
    "UiPath.System.Activities": "[20.10.1]",
    "UiPath.UIAutomation.Activities": "[20.10.6]"
  },
  "webServices": [],
  "entitiesStores": [],
  "schemaVersion": "4.0",
  "studioVersion": "20.10.2.0",
  "projectVersion": "1.0.1",
  "runtimeOptions": {
    "autoDispose": false,
    "isPausable": true,
    "requiresUserInteraction": true,
    "supportsPersistence": false,
    "excludedLoggedData": [
      "Private:*",
      "<em>password</em>"
    ],
    "executionType": "Workflow",
    "readyForPiP": false,
    "startsInPiP": false
  },
  "designOptions": {
    "projectProfile": "Developement",
    "outputType": "Process",
    "libraryOptions": {
      "includeOriginalXaml": false,
      "privateWorkflows": []
    },
    "processOptions": {
      "ignoredFiles": []
    },
    "fileInfoCollection": [],
    "modernBehavior": false
  },
  "arguments": {
    "input": [
      {
        "name": "argument1",
        "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
        "required": false,
        "hasDefault": false
      },
      {
        "name": "argument2",
        "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
        "required": false,
        "hasDefault": false
      }
    ],
    "output": []
  },
  "expressionLanguage": "VisualBasic",
  "entryPoints": [
    {
      "filePath": "Main.xaml",
      "uniqueId": "5289efb0-f8bc-42f3-8cf4-0caa3a7d1915",
      "input": [
        {
          "name": "argument1",
          "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "required": false,
          "hasDefault": false
        },
        {
          "name": "argument2",
          "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "required": false,
          "hasDefault": false
        }
      ],
      "output": []
    },
    {
      "filePath": "Flowchart.xaml",
      "uniqueId": "d0904ba0-506e-437d-979c-b9da4325faad",
      "input": [
        {
          "name": "argument1",
          "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "required": false,
          "hasDefault": false
        },
        {
          "name": "argument2",
          "type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "required": false,
          "hasDefault": false
        }
      ],
      "output": []
    }
  ],
  "isTemplate": false,
  "templateProjectData": {},
  "publishData": {}
}

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新