SDK · C# / .NET
OPC UA in C# / .NET
UA-.NETStandard is the official reference implementation, which makes it the definitive answer to "what should this do?" and the stack most likely to be conformant. The trade is verbosity: expect real application configuration before your first read.
| Project | OPCFoundation/UA-.NETStandard |
|---|---|
| Version | 1.5.378.156 stable, 2.0.0-preview.2 |
| Licence | OPC Foundation dual (MIT for the reference implementation) |
| Install | dotnet add package OPCFoundation.NetStandard.Opc.Ua |
What to know before you start
- The 2.0 line targets specification 1.05.07 and runs on .NET 10, 9 and 8 LTS plus .NET Framework 4.8.
- Being the reference implementation cuts both ways: it is correct and complete, and it assumes you want control over everything.
- Application configuration is not optional boilerplate: it holds your certificate stores, and getting it wrong is the usual cause of a first-connection failure.
- Migration from 1.5.378 to 2.0 is assisted by a MigrationAnalyzer package with analyzer rules and code fixes.
- If you intend to certify a product, starting here removes a class of conformance risk.
Recipes
The same twelve tasks, in this stack, pinned to the version above. Each one runs against a free public server.
| Task | What it does |
|---|---|
| Connect to an OPC UA server in C# | Build an ApplicationConfiguration, select an endpoint, then create a session. The configuration is not boilerplate you can skip: |
| Browse an OPC UA address space in C# | Call Browse with a filter on reference type and node class, and handle the continuation point. Ask for TypeDefinition in the resul |
| Read a value from an OPC UA server in C# | ReadValue returns a DataValue carrying the value, the status code and both timestamps. Use StatusCode.IsGood before trusting the n |
| Write a value to an OPC UA server in C# | Read the node's DataType, build a Variant of that exact type, and inspect the per-operation status code in the response. A write r |
| Subscribe to data changes in C# | Create a Subscription with the publishing interval your consumer needs, add MonitoredItems with their own sampling interval, queue |
| Call an OPC UA method in C# | session.Call takes the owning object's node id, the method's node id and the input arguments. It returns the output arguments, and |
| Set up OPC UA certificates in C# | The application configuration owns your PKI. Point the four stores at persistent directories, keep AutoAcceptUntrustedCertificates |
| Decode custom structures in C# | Load the server's data type system, then read the structured value and access it through its decoded form. Without the type system |
| Read historical data in C# | Use HistoryRead with a ReadRawModifiedDetails and bound the window. Check the server claims a historical facet first, and ask for |
| Subscribe to alarms and events in C# | Monitor the Server object's EventNotifier with an EventFilter whose select clause names the fields you want. The reference stack h |
| Use OPC UA PubSub in C# | The .NET reference stack is one of the few that implements Part 14 properly. Configure a publisher with a PublishedDataSet, a Writ |
| Handle errors and reconnect in C# | Use SessionReconnectHandler. It re-establishes the session and attempts to transfer your subscriptions, which is far better than t |
Last verified 7 September 2026 against OPC UA 1.05.07. Version read from the project release tags. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.