cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using .NET 4.5 features

Former Member
0 Likes
1,921

Hi,

is there a way to use the .NET 4.5 framework with PB.NET (12.5 or 12.6)?

My script:

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12!

The system.dll in the references contains the Tls12 and it is also provided by autoscript.

But if I compile the app I get:

'System.Net.SecurityProtocolType' does not contain a definition for 'Tls12'


Tls12 is new in .NET 4.5. So I think that the compiler uses an older version of the framework.


What can I do?


Thanks.

View Entire Topic
Former Member
0 Likes

Thanks to all!

I am almost sure that I have the correct 4.5 assemlies in the references because it shows me the wanted properties. But if I compile it fails. So I think that Powerbuilder uses the wrong compiler.

I have now created an assembly outside from Powerbuilder and compiled it with the 4.5 compiler. I can this use within my application.

Would be nice if Powerbuilder would be really 4.5 compatible.

Marks suggestion would be great.

Regards

René

Former Member
0 Likes

Hi Rene.

Reviewing all the conversation I did some testing. Created a wpf application, and changed references to point to .net 4.5. Added system.net and the command you try to run in a command button. Compilation fails in all senarios I tested. Also in one machine where I was testing beside I was changing references to point to .net 4.5, they remained to .net 4.0 (this one is using win 8.1)...

I believe that in your project the references you are using are for .net 4.0! I a previous post i put some screenshots which shows how to check that... For me every test I did, from migration to create a new project, I always ended using .net 4.0 after deployment. Never saw a reference to .net 4.5 in my deployed project!

I tend to believe that what Chris mentions, that pb 12.6 is .net 4.5 compatible but not really 100% aware, is the true. Actually I believe that pb 12.6 still uses .net 4.0 but has been tested to overcome some issues that pb 12.5 had with .net 4.5. At that point, if I'm wrong, I would appreciate if someone who is better informed than me corrects me.

What is really strange also is that for that question I haven't seen any reply from people working in pb support. Not to provide support, but simply to clarify if pb can create projects based on .net 4.5... Also I wonder what is the "Updated support for the .NET Framework v4.5" which is one of the announced changes for pb 12.6 (it's also mentioned in ISUG-TECH program and the Overview of Pb 12.6 scheduled for March 31, 2015). Is it only to make the product compliant with win8?

At that point I will simply add that if pb 12.6 cannot create projects using .net 4.5 (which at this point I do believe), it's a shock (at least for me). Maybe I misunderstood but I really thought it was in the new features.

Andreas.

Former Member
0 Likes

Hi Andreas,

my reference points to C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll

There is only this one version there.

I'm not sure if it's 4.5 or 4.0. I heard that 4.5 will be installed as update for 4.0.

File version is 4.0.30319.18408, that's the version number for .NET 4.5.1 on Windows 7 SP1 64-bit

If I navigate through the references in PB.NET I can find System.Net.SecurityProtocolType.Tls12! (see screenshot in one of my previous posts) so it seems to be 4.5.

René


Former Member
0 Likes

Ok Rene.

Let's see it in a different way, In your <your_application>.out folder, there should be a file named assemblies.txt. Do you see there system.net.dll mentioned? If yes under what path?

Also if you try to open your <your_application>.pbtx file, wich is a xml file, using notepad, you can search for system.net (which is different between .net 4.0 and .net 4.5). What version do you see?

For me it is:

<Reference Include="System.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
  <Name>System.Net</Name>
  <AssemblyName>System.Net.dll</AssemblyName>
  <Private>False</Private>
</Reference>

Andreas.

Former Member
0 Likes

System.Net.SecurityProtocolType.Tls12! is part of system.dll, not of system.net.dll!

In assemblies.txt ist only one line that points to sybase.powerbuilder.wcf.runtime.dll

In the .pbtx I find this:

<Reference Include="System">
  <RequiredTargetFramework>4.0</RequiredTargetFramework>
  <Private>False</Private>
</Reference>

I tried to change RequiredTargetFramework to 4.5 but it is still the same error.

Former Member
0 Likes

Ok..

I'm not really familiar with networking classes in .net framework... You are right it's in System. But after all the testing I do I believe pb 12.6 uses .net 4.0 as pb 12.5.x does...

What I also remarked now, is that Tls12 is provided by autoscript even in pb 12.5.2...

Have a nice day.

Andreas.

Former Member
0 Likes

I have PB12.6 .NET (build 3506) running in a Windows 7 VM on my Mac.

I don't even have the .NET SDK from 4.0 - I only have the 4.5 and 4.5.1 SDK, and PB.Net runs just fine.  I believe the "required" setting of 4.0 that you're seeing in the .pbtx file is a "minimum" level, not the "exact" level.

-Paul-

Former Member
0 Likes

Hi Paul;

  FYI:  You only need the .NET SDK when you are working on building & publishing Web Services. Otherwise, the PB IDE (both Classic and .Net) do not need the SDK installed and in fact could not care less whether its there or not.

  FWIW: The fact that when PB 12.6 uses the SDK (and its obviously v4.5 in your case) - does not mean that its using v4.5 feature set. In fact, its using the v4.0 feature set within the v4.5 SDK from what I can see.

Regards ... Chris