Files
UA-.NETStandard/Directory.Packages.props
b76022d13d Add MinimalClient - lightweight OPC UA console client with fluent API (#4006)
# Description

Adds `MinimalClient`, a compact console OPC UA application demonstrating
the unified dependency-injection surface, secure endpoint discovery,
managed sessions, fluent V2 subscriptions, and Alarms & Conditions
support.

## Changes

- Adds `ConfigureApplication(options => ...)` to build and validate one
shared `ApplicationConfiguration` for combined client/server hosts.
- Extends `OpcUaClientOptions` so the existing `AddClient(options =>
...)` callback accepts application identity, PKI, and
certificate-validation settings like `AddServer(...)`.
- Composes root `ConfigureApplication(...)` values with client defaults
in either registration order; shared values take precedence and client
values fill gaps.
- Keeps server samples on their established `AddServer(...)`
configuration pattern.
- Adds `MinimalClient` as a .NET 10 Native AOT console application using
top-level statements and `HostApplicationBuilder`.
- Discovers a `SignAndEncrypt` / `Basic256Sha256` endpoint by default;
`--insecure` and `--auto-accept` are explicit opt-ins with warnings.
- Demonstrates fluent `AddSubscription(...)`,
`TryAddMonitoredItem(...)`, and `AlarmClientFactory` usage.
- Adds targeted configuration, client, and combined client/server tests.

## Example

```csharp
builder.Services
    .AddOpcUa()
    .AddClient(options =>
    {
        options.ApplicationName = "MinimalClient";
        options.ApplicationUri = "urn:localhost:OPCFoundation:MinimalClient";
        options.ProductUri = "uri:opcfoundation.org:MinimalClient";
        options.Session = new ManagedSessionOptions
        {
            SessionName = "MinimalClient",
            SessionTimeout = TimeSpan.FromSeconds(60)
        };
    })
    .AddDiscoveryAndConnect(options =>
    {
        options.DiscoveryUrl = discoveryUrl;
        options.SecurityMode = MessageSecurityMode.SignAndEncrypt;
        options.SecurityPolicyUri = SecurityPolicies.Basic256Sha256;
    })
    .AddSubscriptions()
    .AddAlarms();
```

## Related Issues

_If there is no issue yet, open one and link it here._

## Checklist

- [ ] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [x] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [x] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce new build or
analyzer warnings.
- [ ] I ran all tests locally using the `UA.slnx` solution against at
least .NET Framework and .NET 10.
- [ ] I fixed all failing and flaky tests in the CI pipelines and all
CodeQL warnings.
- [x] I have addressed all PR feedback received.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <romanett98@gmail.com>
Co-authored-by: Marc Schier <marcschier@hotmail.com>
2026-07-17 19:36:53 +02:00

145 lines
10 KiB
XML

<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<!-- Pin transitive package versions so PackageVersion entries below force the
resolved version everywhere they appear in the dependency graph, even when
no project declares a direct PackageReference. Used to remediate transitive
NU1903 vulnerabilities (System.Net.Http 4.3.0, System.Text.RegularExpressions
4.3.0) pulled in by Microsoft.AspNetCore.* 2.3.x on net8.0/net9.0/netstandard2.1. -->
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="BitFaster.Caching" Version="2.6.0" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2" />
<PackageVersion Include="Confluent.Kafka" Version="2.15.0" />
<PackageVersion Include="coverlet.collector" Version="10.0.1" />
<PackageVersion Include="Crdt" Version="1.1.0" />
<PackageVersion Include="Crdt.Transport" Version="1.1.0" />
<PackageVersion Include="Dekaf" Version="1.2.0" />
<PackageVersion Include="DotNext" Version="5.26.3" />
<PackageVersion Include="RaftCs" Version="1.1.0" />
<PackageVersion Include="RaftCs.Transport" Version="1.1.0" />
<PackageVersion Include="RaftCs.Transport.NanoMsg" Version="1.1.0" />
<PackageVersion Include="RaftCs.Storage.File" Version="1.1.0" />
<PackageVersion Include="EmbedIO" Version="3.5.2" />
<PackageVersion Include="JsonSchema.Net" Version="9.2.2" />
<PackageVersion Include="Makaretu.Dns.Multicast" Version="0.27.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.Certificate" Version="8.0.28" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.28" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.28" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.28" />
<PackageVersion Include="Microsoft.AspNetCore.Connections.Abstractions" Version="2.3.11" />
<PackageVersion Include="Microsoft.AspNetCore.Hosting" Version="2.3.11" />
<PackageVersion Include="Microsoft.AspNetCore.Http" Version="2.3.11" />
<PackageVersion Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.3.11" />
<PackageVersion Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.3.11" />
<PackageVersion Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="2.3.11" />
<PackageVersion Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="2.3.11" />
<PackageVersion Include="Microsoft.AspNetCore.WebSockets" Version="2.3.11" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.9" />
<PackageVersion Include="Microsoft.Bcl.TimeProvider" Version="10.0.9" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.14.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.7.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="10.7.0" />
<PackageVersion Include="ModelContextProtocol" Version="1.4.0" />
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="1.4.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.7.0" />
<PackageVersion Include="Microsoft.SourceLink.AzureRepos.Git" Version="10.0.300" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.300" />
<PackageVersion Include="System.CommandLine" Version="2.0.9" />
<PackageVersion Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="18.7.37220.1" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="TUnit" Version="1.58.0" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.10.85" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<!--
PacketDotNet and SharpPcap are native-code dependencies of
Opc.Ua.Core.Diagnostics, Opc.Ua.PubSub.Diagnostics and (for the
opt-in WithPcap() backend, net8.0+ only) Opc.Ua.PubSub.Eth. They
dynamically load libpcap on Linux/macOS and Npcap on Windows. Per
SDL native-code policy:
- Versions are pinned (no floating range)
- SBOM tracking is required for every release
- Subscribe to upstream CVE feeds:
* https://github.com/dotpcap/sharppcap/security/advisories
* https://github.com/dotpcap/packetnet/security/advisories
- Review monthly; bump within 30 days for HIGH/CRITICAL CVEs
-->
<PackageVersion Include="PacketDotNet" Version="1.4.8" />
<PackageVersion Include="SharpPcap" Version="6.3.1" />
<PackageVersion Include="NUnit" Version="4.6.1" />
<PackageVersion Include="NUnit.Analyzers" Version="4.14.0" />
<PackageVersion Include="NUnit.Console" Version="3.22.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="6.2.0" />
<PackageVersion Include="ObjectLayoutInspector" Version="0.2.0" />
<PackageVersion Include="PolySharp" Version="1.16.0" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.15.0" />
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.15.0" />
<PackageVersion Include="SharpFuzz" Version="2.3.0" />
<PackageVersion Include="Serilog" Version="4.3.1" />
<PackageVersion Include="Testcontainers" Version="4.13.0" />
<PackageVersion Include="Testcontainers.Kafka" Version="4.13.0" />
<PackageVersion Include="Serilog.Expressions" Version="5.0.0" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="10.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.1.1" />
<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageVersion Include="SourceGenerator.Foundations" Version="2.0.14" />
<PackageVersion Include="System.Buffers" Version="4.6.1" />
<PackageVersion Include="System.Composition.AttributedModel" Version="10.0.9" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="10.0.9" />
<PackageVersion Include="System.Memory" Version="4.6.3" />
<PackageVersion Include="System.Formats.Asn1" Version="10.0.9" />
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />
<!-- Transitive vulnerability pins (consumed via Microsoft.AspNetCore.* 2.3.x on
net8.0/net9.0/netstandard2.1 - default transitives are 4.3.0 with NU1903):
- System.Net.Http 4.3.4 fixes GHSA-7jgj-8wvc-jh57
- System.Text.RegularExpressions 4.3.1 fixes GHSA-cmhx-cq75-c4mj -->
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="System.Collections.Immutable" Version="10.0.9" />
<PackageVersion Include="System.Reflection.Metadata" Version="10.0.9" />
<PackageVersion Include="System.Text.Json" Version="10.0.9" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageVersion Include="System.Security.Cryptography.Cng" Version="5.0.0" />
<PackageVersion Include="System.Threading.Channels" Version="10.0.9" />
<PackageVersion Include="System.Threading.RateLimiting" Version="10.0.9" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
</ItemGroup>
<!-- MQTTnet 5.x dropped net48/net472/netstandard2.1 support. Per-TFM pinning is
required because CentralPackageTransitivePinningEnabled lets the central pin
win over PubSub's VersionOverride for transitive consumers (e.g. samples
that ProjectReference Opc.Ua.PubSub). See src/Opc.Ua.PubSub/Opc.Ua.PubSub.csproj.
When the solution is pinned to netstandard2.1 (CustomTestTarget=netstandard2.1)
the libraries build as netstandard2.1 (MQTTnet v4) while their tests/apps build
as net8.0, so the net8.0 consumers must also use v4 to match the libraries. -->
<ItemGroup Condition="'$(TargetFramework)' == 'net472' OR '$(TargetFramework)' == 'net48' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(CustomTestTarget)' == 'netstandard2.1'">
<PackageVersion Include="MQTTnet" Version="4.3.7.1207" />
</ItemGroup>
<ItemGroup Condition="('$(TargetFramework)' != 'net472' AND '$(TargetFramework)' != 'net48' AND '$(TargetFramework)' != 'netstandard2.1') AND '$(CustomTestTarget)' != 'netstandard2.1'">
<PackageVersion Include="MQTTnet" Version="5.1.0.1559" />
<PackageVersion Include="MQTTnet.Server" Version="5.1.0.1559" />
</ItemGroup>
</Project>