OpcDaNetCore 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package OpcDaNetCore --version 1.0.1
NuGet\Install-Package OpcDaNetCore -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OpcDaNetCore" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OpcDaNetCore --version 1.0.1
#r "nuget: OpcDaNetCore, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install OpcDaNetCore as a Cake Addin
#addin nuget:?package=OpcDaNetCore&version=1.0.1

// Install OpcDaNetCore as a Cake Tool
#tool nuget:?package=OpcDaNetCore&version=1.0.1

Opc Da for .NET

This package allows you to use the OPC DA protocol in .net applications.
You can find available servers by specifying the ip address:

var servers = await BrowseOpcDaServers.BrowseServersAsync("localhost");

You can build an OPC DA service using the selected server from previous method:

ServerHost host = servers.FirstOrDefault();
using var server = await new OpcDaFactory()
    .WithServer(host)
    .BuildAsync();

Or you can add server specifications manually:

using var server = await new OpcDaFactory()
    .WithIp("localhost")
    .WithServerName("Kepware.KEPServerEX.V5")
    .BuildAsync();

You can browse nodes:

var browse = await server.BrowseNodeAsync(null);

foreach (var browseElement in browse)
{
    Console.WriteLine($"{browseElement.Name}; {browseElement.Id}; Has children: {browseElement.HasChildren}");
}

var node = browse.FirstOrDefault()?.Id;

browse = await server.BrowseNodeAsync(node);

foreach (var browseElement in browse)
{
    Console.WriteLine($"{browseElement.Name}; {browseElement.Id}; Has children: {browseElement.HasChildren}");
}

See full implementation:

var servers = await BrowseOpcDaServers.BrowseServersAsync("localhost");

foreach (var item in servers)
{
    Console.WriteLine(item.ServerName);
}

Group group1 = new("Group 1", 1000, new List<string> { "Channel1.Device1.Tag1", "Channel1.Device1.Tag2" });
Group group2 = new("Group 2", 1000, new List<string> { "Simulation Examples.Functions.Ramp1", "Simulation Examples.Functions.Sine1" });

using var server = await new OpcDaFactory()
    .WithIp("localhost")
    .WithServerName("Kepware.KEPServerEX.V5")
    .WithGroup(group1, group2)
    .WithDataChangedCallback(PrintValues)
    .BuildAsync();

var browse = await server.BrowseNodeAsync(null);

foreach (var browseElement in browse)
{
    Console.WriteLine($"{browseElement.Name}; {browseElement.Id}; Has children: {browseElement.HasChildren}");
}

Console.WriteLine("------");

var node = browse.FirstOrDefault()?.Id;

browse = await server.BrowseNodeAsync(node);

foreach (var browseElement in browse)
{
    Console.WriteLine($"{browseElement.Name}; {browseElement.Id}; Has children: {browseElement.HasChildren}");
}

Console.WriteLine("------");

Console.ReadKey();

static void PrintValues(IEnumerable<ItemDataValue> items)
{
    foreach (var item in items)
    {
        Console.WriteLine($"{item.ItemName}: {item.Value}");
    }
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 282 11/18/2023
1.0.2 175 8/19/2023
1.0.1 126 8/19/2023
1.0.0 123 8/18/2023