- 发行说明
- 概述
- 入门指南
- UiPath 市场供应商
- UiPath Marketplace 客户
- 发布准则
- 即用型自动化发布准则
- 安全性与 IP 保护
- 其他 UiPath 列表
- 连接器
- 如何创建活动
- 构建集成
构建活动包
鉴于 UiPath 的平台基于 .NET Framework 构建,因此所有活动均以 Nuget 包(即 .nupkg 直接从 Go 下载活动时获得的文件! UiPath Studio包管理器中的订阅源)。 将文件捆绑到单个 Nuget 包需要 4 种类型的文件:
程序集信息文件
[assembly: AssemblyTitle("MyCompany.MyProduct.Activities")]
[assembly: AssemblyDescription("This activity was made using the UiPath Activity Set extension.")]
[assembly: ComVisible(false)]
[assembly: Guid("133E5191-68DA-4F05-9A81-D5CFA16525C8")]
[assembly: AssemblyTitle("MyCompany.MyProduct.Activities")]
[assembly: AssemblyDescription("This activity was made using the UiPath Activity Set extension.")]
[assembly: ComVisible(false)]
[assembly: Guid("133E5191-68DA-4F05-9A81-D5CFA16525C8")]
AssemblyInfo.cs 包含此特定项目独有的元数据(例如 MyCompany.MyProduct)。
- “程序集 标题”为 DLL 提供一个友好名称。 为简单起见,这应与项目的名称匹配。
-
程序集 说明是对程序集的性质和目的的简短摘要。
还可能包含其他几个属性,例如区域性或版本号。 有关完整列表,请参阅 Microsoft 官方文档。
- ComVisible和Guid是引用此项目事件库的应用程序使用的默认属性。 对于大多数活动,它们保持不变,但您可以在此处阅读有关其效果的更多信息。
#if DEBUG
[assembly: AssemblyVersion("1.0.*")]
#else
[assembly: AssemblyVersion("1.0.0")]
#endif
#if DEBUG
[assembly: AssemblyVersion("1.0.*")]
#else
[assembly: AssemblyVersion("1.0.0")]
#endif
下一个程序集文件 <your activity name>AssemblyInfo.cs 包含元数据,这些元数据对于整个活动集是唯一的,但在所有项目之间共享;在这种情况下,只有活动版本。 请注意,每个 Visual Studio 配置的版本都不同:
- 调试:如果 Visual Studio 处于调试模式,则构建活动时使用的版本号为 1.0.*, 这意味着已设置主要版本和次要版本 (1.0),并且补丁版本在每次内部版本中递增。 这在频繁更改相同代码时非常有用,因为每个后续包都将使用新版本构建,从而很容易区分。
-
发布:如果 Visual Studio 处于发布模式,则设置版本号(例如 1.0.0)。 这样可以完全控制包何时正式发布。
[assembly: AssemblyCompany("MyCompany")]
[assembly: AssemblyProduct("Product A")]
[assembly: AssemblyCopyright("MyCompany © 2019")]
[assembly: AssemblyTrademark("MyCompany™")]
[assembly: AssemblyCulture("en-CA")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyCompany("MyCompany")]
[assembly: AssemblyProduct("Product A")]
[assembly: AssemblyCopyright("MyCompany © 2019")]
[assembly: AssemblyTrademark("MyCompany™")]
[assembly: AssemblyCulture("en-CA")]
[assembly: NeutralResourcesLanguage("en-US")]
GlobalAss口号Info.cs 包含在您生成的所有活动集之间共享的元数据。 例如, UiPath.GSuite.Activities和UiPath.MicrosoftOffice365.Activities包由同一家公司(UiPath) 创建,面向相同的产品(UiPath Studio),并且具有相同的版权、商标和语言信息,因此它们使用以避免不必要的重复。
Nuspec
将所有项目编译为 DLL 后,系统会将这些库捆绑到一个 Nuget 包中,该包可在 UiPath Studio 中使用。 此包的元数据来自设计项目中的 nuspec 文件。
您可以在此处查看通过 nuspec 提供的元数据元素的完整列表,但请先查看下面的基本示例。 这些元素与 UiPath Studio 包管理器中显示的字段相对应,并允许用户找到并区分您的活动集。
$element$
形式的标签。 它们从“AssemblyInfo”文件中的相应标签获取值,以防止重复信息。
<?xml version="1.0"?>
<package>
<metadata>
<id>$title$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<description>$description$</description>
<copyright>$copyright$</copyright>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<projectUrl>https://integrations.uipath.com/docs/integrating-with-uipath</projectUrl>
<iconUrl>https://raw.githubusercontent.com/NuGet/Samples/master/PackageIconNuspecExample/icon.png</iconUrl>
<tags>UiPath Activit</tags>
<dependencies>
</dependencies>
</metadata>
<files>
<file src="$OutputPath$**\)\)MyCompany.MyProduct*resources.dll" target="lib\)
et461"/>
</files>
</package>
<?xml version="1.0"?>
<package>
<metadata>
<id>$title$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<description>$description$</description>
<copyright>$copyright$</copyright>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<projectUrl>https://integrations.uipath.com/docs/integrating-with-uipath</projectUrl>
<iconUrl>https://raw.githubusercontent.com/NuGet/Samples/master/PackageIconNuspecExample/icon.png</iconUrl>
<tags>UiPath Activit</tags>
<dependencies>
</dependencies>
</metadata>
<files>
<file src="$OutputPath$**\)\)MyCompany.MyProduct*resources.dll" target="lib\)
et461"/>
</files>
</package>
设计器元数据
创建活动并构建设计器(用户界面元素)后,必须将它们链接在一起并在元数据存储中注册,以便在 UiPath Studio 的“活动”面板中显示。 以下代码通过代表两个活动(“父作用域”和“子活动”)注册以下信息来创建两个活动:
- “类别”:活动窗格中将显示这些活动的部分。 默认情况下,这设置为“我的公司” > “我的产品”,并且可以通过修改 Resources.resx中的“类别”属性来进行更改。 了解第 12 行如何将活动项目中的类链接到第 10 行中指定的类别。
- “设计器”:该活动的用户界面。 了解第 13 行如何将活动项目中的类链接到设计项目中的类。
-
文档:活动的在线文档。 选择其中一个 UiPath 工作流中的任何活动,按 F1,即可在默认浏览器中打开该活动的帮助文档。 如第 14 行所示,此文档的 URL 在此处指定(使用go.uipath.com 作为占位符)。
namespace MyCompany.MyProduct.Activities.Design { public class DesignerMetadata : IRegisterMetadata { public void Register() { var builder = new AttributeTableBuilder(); builder.ValidateTable(); var categoryAttribute = new CategoryAttribute($"{Resources.Category}"); builder.AddCustomAttributes(typeof(ParentScope), categoryAttribute); builder.AddCustomAttributes(typeof(ParentScope), new DesignerAttribute(typeof(ParentScopeDesigner))); builder.AddCustomAttributes(typeof(ParentScope), new HelpKeywordAttribute("https://go.uipath.com")); builder.AddCustomAttributes(typeof(ChildActivity), categoryAttribute); builder.AddCustomAttributes(typeof(ChildActivity), new DesignerAttribute(typeof(ChildActivityDesigner))); builder.AddCustomAttributes(typeof(ChildActivity), new HelpKeywordAttribute("https://go.uipath.com")); MetadataStore.AddAttributeTable(builder.CreateTable()); } } }
namespace MyCompany.MyProduct.Activities.Design { public class DesignerMetadata : IRegisterMetadata { public void Register() { var builder = new AttributeTableBuilder(); builder.ValidateTable(); var categoryAttribute = new CategoryAttribute($"{Resources.Category}"); builder.AddCustomAttributes(typeof(ParentScope), categoryAttribute); builder.AddCustomAttributes(typeof(ParentScope), new DesignerAttribute(typeof(ParentScopeDesigner))); builder.AddCustomAttributes(typeof(ParentScope), new HelpKeywordAttribute("https://go.uipath.com")); builder.AddCustomAttributes(typeof(ChildActivity), categoryAttribute); builder.AddCustomAttributes(typeof(ChildActivity), new DesignerAttribute(typeof(ChildActivityDesigner))); builder.AddCustomAttributes(typeof(ChildActivity), new HelpKeywordAttribute("https://go.uipath.com")); MetadataStore.AddAttributeTable(builder.CreateTable()); } } }
构建活动集
完成上述文件后,即可轻松构建活动集。 在“解决方案资源管理器”中,只需右键单击您的解决方案,然后选择“重建解决方案”。
然后,输出面板将指示所有三个项目都已成功构建,并将提供捆绑的 nupkg 文件的路径。
构建后脚本
导航至“设计”项目的“属性”>“构建事件”,您将找到一个构建后脚本,该脚本会在构建所有项目后立即运行。
此脚本的第一行将删除输出目录中存在的包的所有较旧版本,以防止出现混乱。
第二行使用 NuGet 命令行工具 (nuget.exe) 将 3 个项目的 DLL 合并到一个可由 UiPath Studio 读取的 NuGet 包中。
if exist $(TargetDir)Packages\)\)MyCompany.MyProduct*.* del $(TargetDir)Packages\)\)MyCompany.MyProduct*.*
if $(ConfigurationName) == Debug "$(SolutionDir).nuget\)\)NuGet.exe" pack "$(ProjectPath)" -OutputDirectory "Packages" -IncludeReferencedProjects -Prop Configuration=$(ConfigurationName)
if exist $(TargetDir)Packages\)\)MyCompany.MyProduct*.* del $(TargetDir)Packages\)\)MyCompany.MyProduct*.*
if $(ConfigurationName) == Debug "$(SolutionDir).nuget\)\)NuGet.exe" pack "$(ProjectPath)" -OutputDirectory "Packages" -IncludeReferencedProjects -Prop Configuration=$(ConfigurationName)