logo WinWrap®
September 29, 2021

WinWrap® Basic WWB.NET/5+ Scripts

Updated announcement regarding WWB.NET/5: Microsoft will release .NET 6 before the end of 2021. WinWrap® Basic will support .NET 6 just like it supports .NET 5. The WWB.NET/5 language has been renamed WWB.NET/5+ in anticipation of .NET 6 and beyond. Existing scripts using '#Language "WWB.NET/5" will be treated as '#Language "WWB.NET/5+".

Announcing the availablity of the WinWrap® Basic WWB.NET/5+ Language Option enabling developer and end-user scripts to access and call the thousands of reusable classes from Microsoft's .NET 5+.

The WinWrap® Basic WWB.NET/5+ Application Certificate option enables:

  • WWB.NET/5+ Scripting for COM host applications
  • WWB.NET/5+ Scripting for .NET 4 host applications
  • WWB.NET/5+ Scripting for .NET 5+ host applications
  • Simultaneous access to the Microsoft .NET 4 and .NET 5+
  • Simultaneous access to 3rd Party .NET 4 and .NET 5+ Code Assemblies

WWB.NET Scripting Language

Microsoft .NET 5+

In November of 2019 Microsoft released of .NET 5. The naming of .NET 5 is a bit confusing. It is a continuation of Microsoft's .NET Core v3 implementation of .NET. It is not a direct successor to Microsoft's .NET 4 Framework implementation of .NET. These two implementations of .NET have mostly similar types, but the implementation details are completely different. An instance of a .NET 4 type cannot be used by .NET 5+. Similarly, an instance of a .NET 5+ type cannot be used by .NET 4.

Microsoft .NET 5.0 and beyond

Microsoft currenly states that future versions of .NET (e.g. .NET 6) will be backward compatible all the way to .NET 5, but not with .NET 4.

To use WWB.NET/5+ install latest .NET 5+ release from Microsoft and for an additional annual licensing fee, add the WWB.NET/5+ option (or .NET 5+ Host option) to your Application Certificate.

WWB.NET/4 and WWB.NET/5+

Two new "languages" have been added to WinWrap Basic: "WWB.NET/4" and "WWB.NET/5+". These languages determine the primary implementation of .NET that the script can access. Since accessing both .NET 4 and .NET 5+ simultaneously may be a script requirement, the "other" implementation of .NET can be accessed using the new .NET other character (@) when specifying a type.

COM Host Application Developers

WinWrap's WWB.NET/5+ Scripting Language Option enables developers and end-users to access and call the thousands of reusable classes in the .NET 5+. In fact, adding the WinWrap® Scripting Engine with the WWB.NET Language Option to your COM application may be the most cost effective to add the entire power of the Microsoft .NET 5+ to your existing COM application. The WWB.NET/5+ language provides direct access to .NET 5+ types while The WWB.NET/4 language provides direct access to .NET 4 types. With the WWB.NET/5+ Scripting language option both .NET 4 and .NET 5+ are accessible at the same time.

.NET 4 Host Application Developers

WinWrap's WWB.NET/5+ Scripting Language Option will give developers and end-users the ability to access and call the many reusable classes, interfaces, and value types contained in Microsoft's .NET 5+ Class Library. With the WWB.NET/5+ Scripting language option both .NET 4 and .NET 5+ are accessible at the same time.

WWB.NET/5+ Script Examples

.NET 5+ provides a Json assembly (System.Text.Json.dll) for working with JSON text. .NET 4 does not include this namespace/dll. The two sample scripts below show how to use this .NET 5+ assemply.

The script below uses .NET 5+ from a .NET 4 style script. The '#Language "WWB.NET/4" special comment indicates that .NET 4 is the primary .NET implementation. (The '#Language "WWB.NET" can be used to be in existing COM and .NET 4 applications because it means the same thing as '#Language "WWB.NET/4".)

'#Reference @System.Text.Json, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 '#Language "WWB.NET/4" Imports System.Collections.Generic Imports @System.Text.Json Sub Main Debug.Clear Dim s As String = Format("Global+Ids", "SymbolInfo") Dim list As New List(Of String) Using doc As @JsonDocument = @JsonDocument.Parse(s) Dim root As @JsonElement = doc.RootElement Dim ids As @JsonElement = root.GetProperty("ids") For Each p As @JsonProperty In ids.EnumerateObject list.Add p.Name Next End Using For Each item As String In list Debug.Print item Next End Sub

Notice that the script references a .NET 5+ assembly from a WWB.NET script. To access a .NET 5+ type from a WWB.NET script a type name is prefixed with an @ character. The @ character means the type comes from the other .NET implementation which in this case is .NET 5+ because .NET 4 is the primary .NET implementation.

The script below uses the .NET 5+ to do the same thing, but in this case .NET 5+ is the primary .NET implementation as indicated by the '#Language "WWB.NET/5+" line. And, to demostract access to .NET 4, the list of strings is stored in a .NET 4 System.Collections.Generic.List(Of String). Here using the @ character before the type name means the type comes from the other .NET implementation which in this case is .NET 4 because .NET 5+ is the primary .NET implementation.

'#Reference @System.Text.Json, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 '#Language "WWB.NET/5+" Imports System.Text.Json Imports @System.Collections.Generic Sub Main Debug.Clear Dim s As String = Format("Global+Ids", "SymbolInfo") Dim list As New @List(Of String) Using doc As JsonDocument = JsonDocument.Parse(s) Dim root As JsonElement = doc.RootElement Dim ids As JsonElement = root.GetProperty("ids") For Each p As JsonProperty In ids.EnumerateObject list.Add p.Name Next End Using For Each item As String In list Debug.Print item Next End Sub

Conclusion

In summary, for both .NET and COM host applications, Polar Engineering's WinWrap® Basic Scripting Engine with the WWB.NET/5+ Language Option enables developer and end-user scripts to access and call any .NET 5+ Code Assembly.

Copyright Polar Engineering, Inc.