Issue with .net6.0 custom activities

Im trying to migrate my custom activities to 6.0 framework and im using this docs for it

but when i add this

<PackageReference Include="UiPath.Workflow.Runtime" Version="6.0.0-20220401-03" PrivateAssets="All" />
		<PackageReference Include="UiPath.Workflow" Version="6.0.0-20220401-03" PrivateAssets="All" />
		<PackageReference Include="System.Activities.Core.Presentation" Version="6.0.0-20220318.2" PrivateAssets="All" />
		<PackageReference Include="System.Activities.Metadata" Version="6.0.0-20220318.2" PrivateAssets="All"

in the .csproj file of my project it is shoing me warning in the solution explorer in the
net6.0-windows > Pakages > “all the pakages that i added with this code is showing me a warnin in yellow”

hence it is working and im able to add it in the UiPath but when i run the project with windows compatiblity with my custom activity it is showing me this error

Unexpected error has occurred during the library compilation process:
The assembly compilation returned the following errors:
 * Assuming assembly reference 'System.Data.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' used by 'UiPath.Excel.Activities' matches identity 'System.Data.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of 'System.Data.Common', you may need to supply runtime policy
 * Assuming assembly reference 'System.Data.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' used by 'UiPath.Excel.Activities' matches identity 'System.Data.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of 'System.Data.Common', you may need to supply runtime policy
 * Assuming assembly reference 'System.Data.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' used by 'UiPath.Excel.Activities' matches identity 'System.Data.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of 'System.Data.Common', you may need to supply runtime policy
 * The type 'InArgument<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
 * The type 'InArgument<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
 * The type 'CodeActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
 * 'InsertDataToSqlTable' does not contain a definition for 'DisplayName'
 * The type 'InArgument<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
 * The type 'CodeActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

and here is my .csproj file code

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{14248EFD-2B04-4F22-8FBE-ACFC62A61DC5}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SqlBulkInsert</RootNamespace>
    <AssemblyName>SqlBulkInsert</AssemblyName>
	 <TargetFrameworks>net461;net6.0-windows</TargetFrameworks>
    <FileAlignment>512</FileAlignment>
    <Deterministic>true</Deterministic>
  </PropertyGroup>
	<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
		<Reference Include="PresentationCore" />
		<Reference Include="PresentationFramework" />
		<Reference Include="System" />
		<Reference Include="System.Activities" />
		<Reference Include="System.Activities.Core.Presentation" />
		<Reference Include="System.Activities.Presentation" />
		<Reference Include="System.ComponentModel.Composition" />
		<Reference Include="System.Core" />
		<Reference Include="System.Xaml" />
		<Reference Include="System.Xml.Linq" />
		<Reference Include="System.Data.DataSetExtensions" />
		<Reference Include="Microsoft.CSharp" />
		<Reference Include="System.Data" />
		<Reference Include="System.Xml" />
		<Reference Include="WindowsBase" />
	</ItemGroup>
	<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0-windows' ">
		<PackageReference Include="UiPath.Workflow.Runtime" Version="6.0.0-20220401-03" PrivateAssets="All" />
		<PackageReference Include="UiPath.Workflow" Version="6.0.0-20220401-03" PrivateAssets="All" />
		<PackageReference Include="System.Activities.Core.Presentation" Version="6.0.0-20220318.2" PrivateAssets="All" />
		<PackageReference Include="System.Activities.Metadata" Version="6.0.0-20220318.2" PrivateAssets="All" />
	</ItemGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Activities" />
    <Reference Include="System.ComponentModel.Composition" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Class1.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

We are also facing similar kind of issues after migrating the .net packages to latest version. Is the issues fixed ? If so please share the steps which you have performed
or still you are facing challenges.

if you are using any dependencies (excluding System.Activties and CompostionModel) then its not solved for me right now , but if your activity is just utilizing System.Activties and CompostionModel yes for just this it is solved for me , if you need a detail answer , i will let you know in some time

https://docs.uipath.com/developer/other/latest/developer-guide/using-activity-creator

Could you please share the steps which you have done. I will try it once

When adding the System.Activities.dll to the references folder, avoid using version 4.0.0. Instead, download the DLL file from this link

Also you can find the dll file from this path in your system

“C:\Users<UserName>\AppData\Local\Programs\UiPath\Studio\System.Activities.dll”

. To add the DLL file:

  1. In the references folder, select “Add a Reference” and click on “Browse”.
  2. Locate the downloaded System.Activities.dll version 6.0.0 file and select it.
  3. Follow the steps below when adding the DLL file to the NuGet Package Explorer:
  • In the lib folder, right-click and choose “Add .NET Folder” > “v6.0-windows”. Rename it to v6.0-windows7.0.
  • Right-click the lib folder again and select “Add .NET Framework Folder” > “v4.6.1”.
  • Copy the project DLL file and the provided System.Activities.dll file to the v6.0-windows7.0 folder.
  • Copy the project DLL file and the provided System.Activities.dll file to the v4.6.1 folder.

try this and let me know if it works , also can refer this video

Note 1 :- This steps may not work if you are using any third part dependencies for eg in my case its with sql dependencies

Note 2 :- I haven’t used the official migration method provided by the UiPath docs , for this specific scenario , i have preferd this video for the migration

Edit :- Adding System.Activities.dll in the lib>net6.0-windows7.0 or net461 folder is not required, just add the build dll file

There is this additional step (Nuget Pakage Explorer)

  1. In the edit dependencies
  2. Add Click + in the group tab and add net6.0-windows7.0 in the target framework and hit Ok
  3. Follow the same steps and add net461 in the target framework after creating the new group
2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.