Emit warning instead of an error in package compat (#72518)
authorViktor Hofer <viktor.hofer@microsoft.com>
Tue, 26 Jul 2022 13:35:36 +0000 (15:35 +0200)
committerGitHub <noreply@github.com>
Tue, 26 Jul 2022 13:35:36 +0000 (15:35 +0200)
Based on the discussed in https://github.com/open-telemetry/opentelemetry-dotnet/issues/3448, we are now emitting a warning instead of an error on unsupported target frameworks. We still explicitly indicate that this is an unsupported scenario but don't actively block consumers anymore and also indicate how to suppress the warning.

eng/packaging.targets

index b5bfb5d..4a5a804 100644 (file)
 <![CDATA[<Project InitialTargets="$(_NETStandardCompatErrorFileTarget)">
   <Target Name="$(_NETStandardCompatErrorFileTarget)"
           Condition="'%24(SuppressTfmSupportBuildWarnings)' == ''">
-    <Error Text="$(PackageId) doesn't support %24(TargetFramework). Consider updating your TargetFramework to %(NETStandardCompatError.Supported) or later." />
+    <Warning Text="$(PackageId) $(PackageVersion) doesn't support %24(TargetFramework) and has not been tested with it. Consider upgrading your TargetFramework to %(NETStandardCompatError.Supported) or later. You may also set &lt;SuppressTfmSupportBuildWarnings&gt;true&lt;/SuppressTfmSupportBuildWarnings&gt; in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk." />
   </Target>
 </Project>]]>
       </_NETStandardCompatErrorFileContent>