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

Using .NET 4.5 features

Former Member
0 Likes
1,897

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Also, I forgot to ask which version of the sdk is installed on you pc... But you probably allready checked that...

Former Member
0 Likes

I have installed:

.NET Framework 2.0 SDK

.NET Framework 4 Multi-Targeting Pack

.NET Framework 4.5.1

Windows SDK for Windows 7 (7.0)

Former Member
0 Likes

It seems that Powerbuilder uses not the compiler of .NET 4.5.

I have different versions of csc.exe installed. I have moved the directory with .NET 4.5 to the beginning of the PATH. But Powerbuilder still uses another compiler.

Is there a way to specify the compiler?

Former Member
0 Likes

You are right. But it may work if you import the appropriate references.

Take a look at the references... Select System.NET

After look at the properties for the selected references.

For me it always shows that it references .net framework 4.0.

But you can change that by manually removing the references and add them using Browse.

Don't know if it will work... But you can try... Attention... This should be done to all references, otherwise it may not work.

Andreas.

Former Member
0 Likes

The windows SDK 7 should have framework 4. I wonder if you need to install Windows SDK 8.0 to go with framework 4.5...

https://msdn.microsoft.com/en-us/vstudio/dn250998.aspx

(By the way for me it doesn't work in a windows 8.1 machine with visual studio 2013 and frameworks up to 4.5.2, but the windows sdk I installed on that machine is windows 7 SDK).

Andreas.

Former Member
0 Likes

It will all be fixed in Windows 10 ...

Answers (3)

Answers (3)

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

Former Member
0 Likes

Hi René;

FYI ... (for both PB Classic and PB.Net):

PB Version         .Net Version Supported

========         =================

PB 12.x                 3.5

PB 12.5.x              4.0

PB 12.6.x              4.5

Note1: Now saying that, a lower migrated PB version application will still have the old .Net assignments in it. So for example a PB 12.x built application migrated to PB 12.6 will have .Net 3.5 assembly references.

Note2: While PB 12.6.x is .Net 4.5 complaint, I am not sure how v4.5 aware it really is.

Regards ...Chris

Former Member
0 Likes

Hi Chris.

For me this is a bug... I created a new solution in PB.NET 12.6 as Rene mentioned, and references pointed to .net 4.0. Also migrating from PB.NET 12.5 to PB.NET 12.6 doesn't make any change to the references as you state (I mentioned that in my previous post).

But, about your previous message, I can say that from PB.NET 12 to PB.NET 12.5 the Migration updates the .net Framework to v. 4.0!

Using 12.6 4011, 12.5.2 5703 and 12.1 7217 builds.

Andreas.

Former Member
0 Likes

Hi Andreas;

1) Thank you for confirming the .Net migration in PB 12.5. I assume that you mean PB.Net vs PB Classic (where the old .Net references will still be there).

2) Yes, I concur ... PB 12.6 Classic or .Net should migrate your references to .Net 4.5. That certainly seems like a "bug" (issue) to me as well.

Like I said earlier .. I think PB 12.6 is .Net 4.5 compliant but not really 100% aware.  

Have a great weekend!

Regards ... Chris

Former Member
0 Likes

Yes I was talking for PB.NET.

Andreas.

Former Member
0 Likes

Wouldn't it be nice if you could specify this...

Former Member
0 Likes

Hi Mark;

  Yes, that would seem to be a basic feature requirement IMHO for both PB Classic and PB.Net. I know that people had requested it and it was mentioned in the beta testing for 12.0 and 12.5.0 but (as usual) Sybase/SAP seemed to ignore this. 

Regards ... Chris

Former Member
0 Likes

Hi Rene.

Is this an a project that was originally created in PB.NET 12.5 and migrated to PB.NET 12.6? PB.NET 12.6 should be able to use .net framework 4.5. But I've seen that when I migrate a project from PB.NET 12.5 to PB.NET 12.6, the referenced are not affected (even Sybase.DataWindow.Wpf remains with version no 1.5.0.0 but for PB.NET 12.6 it should be 3.0.0.0).

Have you checked the references in your project?

Andreas.

Former Member
0 Likes

I've created a new project in 12.6.

Reference seems to be correct. If I look into the assembly the property is available: