Files
UA-.NETStandard/targets.props
T
Marc Schier 208c601b09 Fix weekly all-TFM UA.slnx build (net8/net9 + netstandard) and add Windows/Linux all-TFM CI build jobs (#3913)
The OPC UA stack builds for seven target frameworks (net472, net48,
netstandard2.0, netstandard2.1, net8.0, net9.0, net10.0), but our
regular pull-request builds only compile two of them (net10.0 and
net48). The complete per-framework build runs only in a weekly scheduled
Azure job, so when a change breaks one of the other frameworks nobody
notices for days. That is exactly what happened in build 14931, which
was red on net8.0, net9.0, netstandard2.0 and netstandard2.1.

This PR fixes all of those broken frameworks. The fixes are small and
framework-specific: a net10.0-only test project reference is made
conditional so net8.0/net9.0 can build, a set of "legacy-stripped"
project shells that failed to compile as empty netstandard assemblies
now build as net10.0, and a few polyfill and NuGet-package collisions in
the netstandard2.1 build are resolved by building its test/app projects
as net8.0 and pinning the matching MQTTnet version. After these changes,
`dotnet build UA.slnx` succeeds cleanly for every framework.

To stop this from regressing, the PR adds two CI jobs that run on every
pull request, in parallel with the existing unit tests: one on Windows
that builds the .NET Framework targets (net472, net48, netstandard2.0)
and one on Linux that builds the modern .NET and netstandard2.1 targets
(net8.0, net9.0, net10.0, netstandard2.1). Together they cover all seven
frameworks and fail the PR if any single one won't build. The workflow's
trigger list was also widened so these jobs run when only build or
configuration files change (for example `*.props` or `*.targets`), not
just C# source. This PR supersedes #3912 and folds in its fixes.
2026-06-25 14:47:57 +02:00

125 lines
6.1 KiB
XML

<Project>
<!-- Suppress warnings for testing only. Rather use supported libraries only. -->
<!--
<PropertyGroup>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>
-->
<!--
A custom target can be used to test a future or legacy target.
A build with all custom targets which are not part of a regular build
is scheduled once a week in the DevOps build pipeline.
Uncomment the following lines to test a custom test target
supported values: netstandard2.0, netstandard2.1, net472, net48, net8.0, net9.0, net10.0
-->
<!--
<PropertyGroup>
<CustomTestTarget>netstandard2.1</CustomTestTarget>
</PropertyGroup>
-->
<Choose>
<!-- Note: to test targets which support deprecated platforms,
set the CustomTestTarget environment variable accordingly -->
<When Condition="'$(CustomTestTarget)' == 'net472'">
<PropertyGroup>
<AnalysisLevel>preview</AnalysisLevel>
<AnalysisMode>all</AnalysisMode>
<AnalysisModeStyle>default</AnalysisModeStyle>
<AppTargetFrameworks>net472</AppTargetFrameworks>
<AppTargetFramework>net472</AppTargetFramework>
<TestsTargetFrameworks>net472</TestsTargetFrameworks>
<LibTargetFrameworks>net472</LibTargetFrameworks>
<LibCoreTargetFrameworks>net472</LibCoreTargetFrameworks>
<LibxTargetFrameworks>net472</LibxTargetFrameworks>
<HttpsTargetFrameworks>net472</HttpsTargetFrameworks>
</PropertyGroup>
</When>
<When Condition="'$(CustomTestTarget)' == 'netstandard2.0'">
<PropertyGroup>
<NetStandardTests>true</NetStandardTests>
<AppTargetFrameworks>net48</AppTargetFrameworks>
<AppTargetFramework>net48</AppTargetFramework>
<TestsTargetFrameworks>net48</TestsTargetFrameworks>
<LibTargetFrameworks>net48</LibTargetFrameworks>
<LibCoreTargetFrameworks>net48</LibCoreTargetFrameworks>
<LibxTargetFrameworks>net48</LibxTargetFrameworks>
<HttpsTargetFrameworks>net48</HttpsTargetFrameworks>
</PropertyGroup>
</When>
<When Condition="'$(CustomTestTarget)' == 'netstandard2.1'">
<PropertyGroup>
<NetStandardTests>true</NetStandardTests>
<!-- netstandard2.1 is a library-only TFM; its build is validated by a net8.0
consumer (apps/tests). net8.0 (unlike net9.0+/net10.0) does not define
System.Threading.Lock or X509CertificateLoader in its BCL, so the
netstandard2.1 libraries' public polyfills for those types do not collide
with the consumer's BCL. This matches the net8.0 framework the netstandard2.1
test stage already runs (azure-pipelines.yml). -->
<AppTargetFrameworks>net8.0</AppTargetFrameworks>
<AppTargetFramework>net8.0</AppTargetFramework>
<TestsTargetFrameworks>net8.0</TestsTargetFrameworks>
<LibTargetFrameworks>netstandard2.1</LibTargetFrameworks>
<LibCoreTargetFrameworks>netstandard2.1</LibCoreTargetFrameworks>
<LibxTargetFrameworks>netstandard2.1</LibxTargetFrameworks>
<HttpsTargetFrameworks>netstandard2.1</HttpsTargetFrameworks>
<SKIP_ECC_CERTIFICATE_REQUEST_SIGNING>true</SKIP_ECC_CERTIFICATE_REQUEST_SIGNING>
</PropertyGroup>
</When>
<When Condition="'$(CustomTestTarget)' == 'net48'">
<PropertyGroup>
<AppTargetFrameworks>net48</AppTargetFrameworks>
<AppTargetFramework>net48</AppTargetFramework>
<TestsTargetFrameworks>net48</TestsTargetFrameworks>
<LibTargetFrameworks>net48</LibTargetFrameworks>
<LibCoreTargetFrameworks>net48</LibCoreTargetFrameworks>
<LibxTargetFrameworks>net48</LibxTargetFrameworks>
<HttpsTargetFrameworks>net48</HttpsTargetFrameworks>
</PropertyGroup>
</When>
<When Condition="'$(CustomTestTarget)' == 'net8.0'">
<PropertyGroup>
<AppTargetFrameworks>net8.0</AppTargetFrameworks>
<AppTargetFramework>net8.0</AppTargetFramework>
<TestsTargetFrameworks>net8.0</TestsTargetFrameworks>
<LibTargetFrameworks>net8.0</LibTargetFrameworks>
<LibCoreTargetFrameworks>net8.0</LibCoreTargetFrameworks>
<LibxTargetFrameworks>net8.0</LibxTargetFrameworks>
<HttpsTargetFrameworks>net8.0</HttpsTargetFrameworks>
</PropertyGroup>
</When>
<When Condition="'$(CustomTestTarget)' == 'net9.0'">
<PropertyGroup>
<AppTargetFrameworks>net9.0</AppTargetFrameworks>
<AppTargetFramework>net9.0</AppTargetFramework>
<TestsTargetFrameworks>net9.0</TestsTargetFrameworks>
<LibTargetFrameworks>net9.0</LibTargetFrameworks>
<LibCoreTargetFrameworks>net9.0</LibCoreTargetFrameworks>
<LibxTargetFrameworks>net9.0</LibxTargetFrameworks>
<HttpsTargetFrameworks>net9.0</HttpsTargetFrameworks>
</PropertyGroup>
</When>
<When Condition="'$(CustomTestTarget)' == 'net10.0'">
<PropertyGroup>
<AppTargetFrameworks>net10.0</AppTargetFrameworks>
<AppTargetFramework>net10.0</AppTargetFramework>
<TestsTargetFrameworks>net10.0</TestsTargetFrameworks>
<LibTargetFrameworks>net10.0</LibTargetFrameworks>
<LibCoreTargetFrameworks>net10.0</LibCoreTargetFrameworks>
<LibxTargetFrameworks>net10.0</LibxTargetFrameworks>
<HttpsTargetFrameworks>net10.0</HttpsTargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<AppTargetFrameworks>net10.0;net9.0;net8.0;net48</AppTargetFrameworks>
<AppTargetFramework>net10.0</AppTargetFramework>
<TestsTargetFrameworks>net472;net48;net8.0;net9.0;net10.0</TestsTargetFrameworks>
<LibTargetFrameworks>net472;net48;netstandard2.1;net8.0;net9.0;net10.0</LibTargetFrameworks>
<LibCoreTargetFrameworks>net472;net48;netstandard2.1;net8.0;net9.0;net10.0</LibCoreTargetFrameworks>
<LibxTargetFrameworks>net472;net48;netstandard2.1;net8.0;net9.0;net10.0</LibxTargetFrameworks>
<HttpsTargetFrameworks>net472;net48;netstandard2.1;net8.0;net9.0;net10.0</HttpsTargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>
</Project>