UiPath Developer

The UiPath Developer Guide

Migrating Activities to .NET 6

This page offers an overview of how to migrate your custom .NET Framework activities to .NET 6 for use in projects with the Windows and cross-platform compatibilities available starting with Studio 2021.10.6.

Step 1: Migrate the project to the new SDK-style format

If your project is using the .NET Framework project format, you must migrate it to the new SDK-style format.

Use the <Project Sdk="Microsoft.NET.Sdk" attribute for most projects. For projects that require WPF,
use <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop" with <UseWpf>true</UseWpf>.

Package references must be declared in the .csproj file as opposed to packages.config. You must declare the following WWF dependencies for .NET.
<PackageReference Include="UiPath.Workflow.Runtime" />
<PackageReference Include="UiPath.Workflow" />
<PackageReference Include="System.Activities.Core.Presentation" />
<PackageReference Include="System.Activities.Metadata" />


To centralize package versions, you can create a global Directory.build.targets file with dependencies used by most projects. For example:

  <ItemGroup Condition="'$(TargetFramework)' != 'net461' ">
    <PackageReference Update="UiPath.Workflow.Runtime" Version="6.0.0-20220401-03" PrivateAssets="All"/>
    <PackageReference Update="UiPath.Workflow" Version="6.0.0-20220401-03" PrivateAssets="All"/>
    <PackageReference Update="System.Activities.Core.Presentation" Version="6.0.0-20220318.2" PrivateAssets="All"/>
    <PackageReference Update="System.Activities.Metadata" Version="6.0.0-20220318.2" PrivateAssets="All"/>
    <PackageReference Update="UiPath.Activities.Api" Version="22.4.1" PrivateAssets="All" />



Do not include the referenced packages in the NuGet package or add them as dependencies in the package metadata. Including the referenced packages results in a failure to install the package in Studio.

Then, in your project file you only need to specify the package name. For example:

<PackageReference Include="CsvHelper"/>

You can create a dedicated .build.targets file for your specific solution to centralize other dependencies and include it in your .csproj files as follows:

<Import Project="..\System.build.targets" />

You can create a dedicated .build.props file for your specific solution to centralize other properties like version, company, etc. Include it in your .csproj files as follows:

<Import Project="..\System.build.props" />

See the Microsoft documentation for a migration example.

Step 2. Add the .NET target framework in all project files

In addition to net461, you must add either the net6.0-windows or net6.0 target framework.

  • For a project you want to be compatible with Windows, add net6.0-windows.
  • For a cross-platform project, add net6.0.

References to DLLs related to the package must be replaced with packages where needed, as in the following sample project file:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
        <Description>API for developing UiPath Activities</Description>
    <ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
        <Reference Include="System.Activities" />
        <Reference Include="System.Activities.Core.Presentation" />
        <Reference Include="System.Activities.Presentation" />
    <ItemGroup Condition="'$(TargetFramework)' != 'net461' ">
        <PackageReference Include="System.Activities" />
        <PackageReference Include="UiPath.Workflow" />
        <PackageReference Include="System.Activities.Core.Presentation" />
        <PackageReference Include="System.Activities.Metadata" />
        <PackageReference Include="UiPath.Activities.Api"/>

Make sure all your dependencies support .NET Core. You might need to find newer package versions or replacement packages.

If parts of your code do not compile and it is feasible to exclude them, consider moving the affected classes under a NetFramework folder and adjust your Directory.build.targets as follows:

    <When Condition="$(TargetFramework.StartsWith('net4'))">
        <Compile Remove="NetCore\**\*.cs" />
        <Page Remove="NetCore\**\*.xaml" />
        <Compile Remove="NetFramework\**\*.cs" />
        <Page Remove="NetFramework\**\*.xaml" />

For smaller lines of code and methods, you can use #if NET461 and related code directives. If this approach is not feasible, consider splitting your activity class names and public properties in a separate .shared project with partial classes and include them in a dedicated .Standard.csproj while they are still included in your main activities project.

Step 3: Create a NuGet package

You can create packages using dotnet pack directly with the .csproj files. For more information, see the Microsoft documentation

  • Consider creating a separate project just for bundling your package.

  • To exclude the .Package DLL, use:

<Target Name="RemoveMetaDll" AfterTargets="BuiltProjectOutputGroup">
      <BuiltProjectOutputGroupOutput Remove="@(BuiltProjectOutputGroupOutput)" />
  • Include all required files explicitly. For example:
<Target Name="AddDlls">
      <BuildOutputInPackage Include="$(OutputPath)CustomInputForm.exe" />
      <BuildOutputInPackage Include="$(OutputPath)UiPath.OrchestratorClient.dll" />
      <BuildOutputInPackage Include="$(OutputPath)UiPath.System.Activities.dll" />
      <BuildOutputInPackage Include="$(OutputPath)UiPath.System.Activities.Design.dll" />
      <BuildOutputInPackage Include="$(OutputPath)de\UiPath.System.Activities.resources.dll" TargetPath="de\UiPath.System.Activities.resources.dll" />
      <BuildOutputInPackage Include="$(OutputPath)de7\UiPath.System.Activities.Design.resources.dll" TargetPath="de\UiPath.System.Activities.Design.resources.dll" />
  • Use the target as follows:
  • Resource DLLs must be listed individually, unless you find an alternative solution.

  • Make sure to add package references with the appropriate TargetFramework conditions.

  • Adjust your CI pipeline to be able to pack the new package format with the [email protected] task. For example:

- task: [email protected]
  displayName: "Create NET .SDK Packages"
  continueOnError: true
    command: "pack"
    packagesToPack: "$(SdkPackagesToPack)"
    configurationToPack: "$(BuildConfiguration)"
    outputDir: "$(ArtifactsOutputPath)"
    nobuild: true
  condition: eq(variables['HasSdkPackages'], 'true')
  • Consider leaving an empty <VersionSuffix></VersionSuffix> tag in your .Package.csproj and adjust your CI scripts to replace it with the -alpha, beta suffixes. Other approaches might be feasible and it depends on your CI pipeline.

  • For local development builds, consider adding a post-build debug step that calls the dotnet pack command.

Vor etwa einem Monat aktualisiert

Migrating Activities to .NET 6

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.