1. Christopher Craft
  2. PowerBuilder
  3. Friday, 28 July 2023 20:12 PM UTC

PB 2022 1900

I posted something similar earlier but I am still having issues so I will try and simplify my question.  

I am trying to develop a DLL from SnapDevlop that will run on a Windows machine with a minimum of .Net framework 4.8 installed.  When trying to select the target framework in SnapDevlop my options are .Net Standard 2.0/2.1, .Net Core 3.1, and .Net 6.0.  When importing the DLL my options are .Net Framework, .Net Core, .Net.

What options should I be selecting in order to get this to work on these Windows machines running at least the 4.8 framework?

Chris Craft

Accepted Answer
Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Friday, 28 July 2023 21:08 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Chris:

.NET Core 3.1: Multi-platform API (Out of support)

.NET 6: Successor to .NET Core 3.1, can be multiplatform

.NET Framework: Not multi-platform. Can access Windows-specific APIs such as WMI, GDI resources, etc

.NET Standard: Set of core APIs that are defined in both .NET Core/.NET 6+ and .NET Framework

For more detailed information see this Microsoft page.

 

In general you should always prefer .NET 6 over .NET Core 3.1, and only go for .NET Framework if your program will make use of Windows-specific APIs, such as the ones I mentioned earlier.

Please note: PowerBuilder 2022 R2 will no longer support selecting .NET Core 3.1 or .NET Framework when importing DLLs

 

Regards,
Francisco

Comment
  1. Christopher Craft
  2. Friday, 28 July 2023 22:48 PM UTC
...to clarify - you said 'For using .Net 6 DLLs you must have the .Net 6 runtime" - this is what I don't want. No machine has this delivered but R2 will now be forcing that right?
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 29 July 2023 22:24 PM UTC
If I understood well, even in PB2022 R2, you can still import a .net framework dll. Even if you don't have the option anymore when using the importer tool, it will work.
  1. Helpful
  1. Christopher Craft
  2. Sunday, 30 July 2023 20:06 PM UTC
Good to know Miguel - although I can't even get the thing working yet! :-)
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 1 August 2023 17:53 PM UTC
  2. PowerBuilder
  3. # 1

Hi Christopher and Fancisco,

Please have a close look at https://www.appeon.com/standardsupport/search/view?id=10354.

Hopefully that will clear up any doubts.

regards.

 

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 1 August 2023 18:29 PM UTC
Hi Miguel;

Yes, the key message there was to stop using the old .Net load methods & switch to the new "generic" LoadWithDotNet" method for PB 2022 R2 & higher releases. ;-)

Regards ... Chris
  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 1 August 2023 18:34 PM UTC
Plus that from R2 onwards, you can still load .Net Framework DLLs by using LoadWithDotNet(). Also the documentation and help is going to be slightly modified to avoid confusion.

regards
  1. Helpful
There are no comments made yet.
Christopher Craft Accepted Answer Pending Moderation
  1. Sunday, 30 July 2023 20:04 PM UTC
  2. PowerBuilder
  3. # 2

Ok - Correct me if I am on the wrong path but this is what I am gathering...

Per Microsofts website...

-------

Which .NET Standard version to target

We recommend you target .NET Standard 2.0, unless you need to support an earlier version. Most general-purpose libraries should not need APIs outside of .NET Standard 2.0. .NET Standard 2.0 is supported by all modern platforms and is the recommended way to support multiple platforms with one target.

-------

So the DLL I create in SnapDevelop should have a target framework of .NET Standard 2.0.  Then when I import using the DLL Importer I will select .NET.  This should allow my DLL to operate on a machine that has the default .Net stuff. This would be the same when I go to PB 2022 R2?

Chris Craft

Comment
  1. Miguel Leeuwe
  2. Tuesday, 1 August 2023 02:38 AM UTC
I haven't tested extensively yet, but it seems that using the import option ".Net" in PB2022 R2 for a .Net Framework DLL DID work for me. Have you tried it on PB 2022 R2 (beta)?

regards
  1. Helpful 1
  1. Francisco Martinez @Appeon
  2. Tuesday, 1 August 2023 16:45 PM UTC
Hi Chris,



Currently, only the LoadWithDotNetFramework supports loading .NET Standard assemblies: https://docs.appeon.com/pb2021/powerscript_reference/LoadWithDotNetFramework_func.html

I only now realize that there might be problems with this moving forward, after selecting .NET Framework in the Importer tool is dropped. Since .NET Standard 2.0 is claimed to be compatible with .NET 6 by Microsoft, I think this is a valid concern that should be brought to the attention of the team, so please submit a bug report raising this predicament.



Regards - Francisco
  1. Helpful
  1. Christopher Craft
  2. Tuesday, 1 August 2023 17:57 PM UTC
Thank you Francisco. I will submit a bug report for this.



Miguel - what was your target framework in your test? I am using .NET standard 2.0.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.