Error with NuGet Package in Windows Compatibilty Mode Which Works in Debug Mode

Today I tried to use the following test library inside UiPath Studio 22.4.3:


using System;
using System.Runtime.InteropServices;

namespace LibraryTest {

  public class LibraryTestLib {

    public string Message() {
      return "Hello World from LibraryTest.LibraryTestLib Message";




I compiled this library with the target frameworks net6.0-windows7.0 and net461 and tested it successfully with PowerShell 5 (Windows - Legacy) and 7 (Windows).


If([System.Environment]::Version.Major -le 4) {
  Add-Type -Path "$($PSScriptRoot)\net461\LibraryTest.dll"
} ElseIf([System.Environment]::Version.Major -gt 4) {
  Add-Type -Path "$($PSScriptRoot)\net6.0-windows7.0\LibraryTest.dll"

[LibraryTest.LibraryTestLib]$LibTest = [LibraryTest.LibraryTestLib]::new();


In my last step I built a test NuGet package to use this test library inside UiPath.

LibraryTest.1.0.0.nupkg (5.2 KB)

This library worked with UiPath as expected in Windows - Legacy compatibility mode.

LibraryTestWindowsLegacy.xaml (3.9 KB)

Also this library worked with UiPath as expected in Windows compatibility mode with debugging.

But this library do not worked with UiPath in Windows compatibility mode at runtime.


LibraryTestWindows.xaml (4.3 KB)

I got the error CS0246 of a missing directive or reference. But I imported my library.


Am I doing something wrong or is this a bug in UiPath Studio when compiling in Windows compatibility mode?

Thanks for hints, tips and solutions.

Hi @StefanSchnell - did you figure this one out?

Hi @StefanSchnell , Thank you for the detailed report. I’ve managed to reproduce the issue in my setup using UiPath.System.Activities=22.4.5.
However, I could not reproduce the issue after upgrading the UiPath.System.Activities package to the latest available version, 22.10.3, therefore my suggestion would be, if possible, to upgrade your setup to the latest version of the package in order to overcome this issue.

1 Like


Hello Liviu,
thank you very much for bringing that into my attention. Yes, with the current release all works well now.
Best regards

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