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:

//-Begin----------------------------------------------------------------

using System;
using System.Runtime.InteropServices;

namespace LibraryTest {

  public class LibraryTestLib {

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

  }

}

//-End------------------------------------------------------------------

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).

#-Begin-----------------------------------------------------------------

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

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

#-End-------------------------------------------------------------------

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.

image

LibraryTestWindows.xaml (4.3 KB)

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

image

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

@LiviuPonova

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

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