UiPath Studio

UiPath Studio 指南

管理依赖项

Studio 中的项目依赖项是指链接到特定项目的包,其中包含了默认活动或自定义活动。依赖项与上下文有关,并且需要考虑每个项目的定义,包括变量、输入/输出参数以及项目使用的活动。因此,仅当项目定义中至少有一个引用时,才会设置依赖项。

All project templates available in Studio come with their own default dependencies packages.

In StudioX, all projects come with the following default packages: UiPath.System.Activities, UiPath.ComplexScenarios.Activities, UiPath.Excel.Activities, UiPath.Mail.Activities, UiPath.UIAutomationNext.Activities, and UiPath.Word.Activities.

如果需要添加更多包,可单击“管理包”按钮并进行安装。安装的依赖项仅可供当前项目使用,各个项目的依赖项列表则可在 project.json 文件中查看。

“项目”面板中显示自动化项目中安装的活动包,以及它们的子依赖项、运行时规则、已请求及已解决的版本。

将光标悬停在依赖项上可查看已请求和已解决的版本。“管理”、“修复”或“删除依赖项”等上下文操作仅适用于依赖项,不适用于其子包。未解决的依赖项在树中用灰色标记,未找到的依赖项用红色标记,而已解决和完全匹配的依赖项则使用阴影和深蓝色标记。

添加和更新依赖项

Whenever new versions are available for the current project dependencies, the Manage Packages button from the ribbon gets an update icon 图像替代文本.

  1. To manage dependencies in a project, simply right-click on the Dependencies category in the Project panel, and then click on Manage. This opens the Manage Packages window, with the Project Dependencies category. The 图像替代文本 icon shows which packages are currently installed.
  1. 将显示默认依赖项以及当前链接到项目的版本。要更新包,只需单击可用版本号旁边的更新图标 图像替代文本图像替代文本 图标显示在包的旁边,这意味着依赖项已经可供安装了。
  2. 只有在单击“保存”之后,才会在项目中安装依赖项。同时,还会在属于项目的 project.json 文件中更新依赖项的版本。

To add dependencies to a project, simply search and install them as you would any activity package. For more information, check the Manage Packages page.

删除依赖项

  1. 要删除某个项目依赖项,只需在“项目”面板中右击该依赖项。
  2. 选择“删除依赖项”,然后该依赖项将从“项目”面板和 project.json 文件中删除。

此外,也可通过单击“管理包”>“项目依赖项”类别中各个依赖项的“卸载”按钮来完成。

修复依赖项

如果在 Studio 中打开的工作流引用了某些包,而这些包的版本在当前 Studio 订阅源中不可用,则表示依赖项在“项目”面板中标记为断开,而且“输出”面板中将提供详细信息。

Studio 允许批量或单独修复所有依赖项。要修复所有损坏的依赖项,请右击“项目”面板中的“依赖项”节点,然后单击“修复依赖项”。

右击已损坏的依赖项,然后选择“解决依赖项”以单独修复该依赖项。此外,也可选择“管理”以打开“管理包”窗口,再更新包。

NuGet resolves broken dependencies by applying the Lowest Applicable Version 图像替代文本 runtime rule, meaning that it searches for the first applicable package version, higher than the one previously set.

Note:

缺失或无效的活动在“设计器”面板中标记,而错误横幅则提供有关工作流及其无法解析的依赖项的其他信息。

设置依赖项规则

活动包提供有多个版本,因此在使用”管理包”安装或更新它们时,您可以为它们分别设置依赖项运行时规则。

“运行时规则”指定要在运行时安装的包版本。它有两个可用的选项。

The Strict runtime rule is the default state for dependencies added upon process creation, and for activities packages installed from the Manage Packages window. It means that only the specified version of the package is used at runtime to execute the parent process. The Strict rule is marked in the Project panel, under Dependencies by the 图像替代文本 sign next to the package version.

The Lowest Applicable Version runtime rule means that if the target package isn’t found, the next higher version is searched in order to resolve dependencies. The Lowest Applicable Version rule is marked in the Project panel, under Dependencies by the 图像替代文本 sign next to the package version.

When executing an automation project from Studio, the Robot downloads the specified or indicated package version it needs to execute the project, in accordance to the previously set runtime rules for each project. If the dependency used during execution has a Strict runtime rule and the exact package version was not found, an error is thrown. For more information on setting runtime rules for project dependencies check the Managing Dependencies page.

解决依赖项冲突

活动包的安装考虑了以前为上述包设置的依赖项运行时规则,但是当项目自动化时,版本之间可能会发生一些冲突。自动化项目和它包含的库都可能有相同的活动包,但版本和运行时规则不同。在设计时,NuGet 通过选择最高级别的依赖项(也就是最接近层次结构中的项目的依赖项)来解决这些冲突。

下面介绍了可能出现的冲突的解决方法:

The project contains an activities package with version 1.0. The library is referenced to the project and uses the same pack, but with a higher version. The top-level dependency v1.0 is used at runtime. A warning is given, mentioning that a downgrade was detected.

The resolution of this scenario is applicable regardless of the runtime rule (Strict 图像替代文本 or Lowest Applicable Version 图像替代文本) previously set for the activities packages.

  • If you choose Yes, the activities package referenced in the project is upgraded to the version used in the library.
  • 如果选择“否”,则“管理包”窗口打开将显示“项目依赖项”列表。

The project contains an activities package with the version 2.0. The library uses the same pack, but with a lower version and the Strict 图像替代文本 runtime rule. The top level dependency used in this case is v2.0 and a warning is given when the package is installed in the project.


The project contains an activities package with the version 2.0. The library uses the same pack, but with a lower version and the Lowest Applicable Version 图像替代文本 runtime rule. The top level dependency used in this case is v2.0 and a warning is given when the package is installed in the project.


The project references a library with an activities package version 1.0 and Strict 图像替代文本 runtime rule. The project references another library, but with an activities package version 2.0. The top level dependency in this case is the pack with v2.0, since it has the highest version. A warning is given when the activities package is installed.


In this conflict the project references two libraries, which in turn have Strict 图像替代文本 dependencies referenced among them. This scenario isn't supported. For detailed information, check the Dependency Resolution page.


如果包引用自身,那么将发生的冲突类型是依赖项循环。如果将项目命名为 UiPath,Studio 将检测到依赖项冲突。这是因为 UiPath 包已经存在,并且依赖于 UiPath.UIAutomation.Activities在命名项目时,建议您避免使用要作为依赖项添加的现有包的名称。

在下面的情况下,会发生相同的依赖项循环:您打开 .xaml 文件时是从名为 UiPath 的文件夹,或者是从名为从您要添加为依赖项的任何现有包,但该文件夹中没有 project.json当您打开一个没有关联 project.json 文件的 .xaml 文件时,Studio 会创建一个 project.json 文件,并用父文件夹的名称来填充 "name" 标签。

打开使用先前版本创建的项目

Important!

Opening projects created with Studio v2016.2 directly in v2020.4 is not supported. First, open these projects with Studio v2018.4 and then with v2020.4.

When opening a project with or without dependencies, designed with a version prior to v2018.3 (except for v2016.2), Studio asks you if an automatic migration shall be performed, so that it may attempt to retrieve missing dependencies or add default ones.

Upon confirmation, Studio attempts to retrieve missing dependencies and sets the Strict 图像替代文本 runtime rule for the packages that it finds. When using the Repair Dependency option in the Project panel, Studio attempts to install the next best package version. If the package version is not found, alerts are shown in the Output panel and you should check the configured feeds in the Manage Packages window.

Processes containing dependencies and that were built with Studio versions prior to v2018.3 continue to execute with Robot v2018.3. The runtime rule for such projects is set to Lowest Applicable Version 图像替代文本.

Projects created with versions prior to v2018.3 that were never published don't have dependencies listed in the project.json file. When opening such projects, an alert in the Output panel notifies you of missing dependencies. UiPath packages delivered locally with Studio are added as dependencies with the Strict 图像替代文本 runtime rule. The latest version of such packages is automatically set.

如果这类项目包含非 Studio 本地随附的包,我们建议:

  • 使用创建此项目的 Studio 版本发布此项目,以此在 project.json 文件中添加依赖项,帮助您完成迁移流程;
  • Manually installing the missing package from the Manage Packages window, after setting up the required feed;
  • Using the Project Dependencies Mass Update tool to add the missing dependency to a bulk of projects.

Note:

无法保存包含无效活动的工作流。安装所需的依赖项,然后保存项目。

活动包 UiPath.V7.ActivitiesUiPath.Platform.ActivitiesUiPath.Framework.Activities 已被弃用。当打开包含 UiPath.Platform.ActivitiesUiPath.Framework.Activities 包的项目时,Studio v2018.3 或更高版本将尝试执行自动迁移,将旧版本的活动替换为新版本。

Important!

如果工作流包含了属于 UiPath.V7.Activities 包的活动,那么工作流无法迁移。

对于某些未自动执行迁移的情况,有一种变通方法。

  1. 使用 Notepad++ 打开 project.json 文件。
  2. 删除 "schemaVersion": "3.2" 参数。
  3. "studioVersion" 替换为 "toolVersion"
  4. "toolVersion" 值从 "18.3.xxx" 更改为先前版本。例如,将值从 "18.3.0.958" 更改为 "18.2.958"。保存文件。
  5. 使用 Studio v2018.3 或更高版本打开 .xaml 文件,这样就会执行迁移了。弃用的活动包将被替换为新版本的活动包,如“项目”面板的“依赖项”部分所示。

Important!

在某些情况下,包含包 UiPath.Platform.ActivitiesUiPath.Framework.Activities.xaml 文件无法自动迁移,并且变通方法也不适用。对于这些情况,建议在 Studiov2018.2 或更低版本中打开项目,然后将属于上述包的活动替换为 UiPath.Core.Activities 包中包含的活动。对于包含 UiPath.V7.Activities 包中的活动的工作流,也可以这样做。

自 Studio v2018.4.1 起,UiPathStudio.msi 安装程序中将不会再打包 Microsoft.Activities v.1.0.1 和 Microsoft.Activities.Extensions v2.0.6.9。

如果在迁移以这些包作为依赖项的项目时需要进行修复,请从“官方”订阅源或本地订阅源安装这两个包。在执行以 v2018.4.1 之前的版本创建的这类项目之前,请确保上述包位于机器人可访问的订阅源中。

若从 v2018.4.1 之前的版本升级,这两个活动包仍会保留在“本地”订阅源中。

Updated 2 months ago


管理依赖项


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.