-
Brad R C
- PowerBuilder
- Saturday, 16 May 2026 04:46 AM UTC
Hi all,
I have a simple class I have used to isolate the issue I have which I will show below.
using System.Drawing;
namespace PBDependencyTest
{
public class PBTest
{
private readonly System.Drawing.Brush brush;
public PBTest()
{
brush = Brushes.White;
}
public string GetBrush()
{
return brush.ToString();
}
}
}
This is a class within a class library that targets net8.0-windows.
The class library references the Nuget package for 'System.Common.Drawing' version 10.0.2. Note that version 10.0.2 is fully compatible with .NET 8 it does not target .NET 10 despite the version potentially indicating that.
I can import this class and the 'GetBrush' function into PowerBuilder 2025 just fine.
However when the application runs it crashes stating it cannot find 'System.Drawing.Common.dll' version 10.0.0 when attempting to construct the class object, the error code is -1.
If I replace the 'System.Drawing.Common.dll' file at
C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.22\ with the one from the Nuget package it works just fine, I see the application is attempting to load the library from the installed runtime instead of understanding it is a dependency?
I have tried putting the library into the same directory as the PowerBuilder application executable but it seems it wont search anywhere other than the installed runtime?
Of course in this example there is no need to use version 10.0.2 but in my actual app many different Nuget packages are used in a similar way and many crashes occur.
I am hoping someone here can explain what I did wrong?
Thanks for any help.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.