I think there might be a problem with how/when we enable the Native SDK. According to the docs IsTargetFrameworkCompatible returns true if the "Candidate" (second argument) is compatible with the "Target" (first argument).
These seem to be reversed here:
|
<FrameworkSupportsNative Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0')) and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true</FrameworkSupportsNative> |
If they're not reversed, that IsTargetFrameworkCompatible function is just plain confusing (and thus error prone) and I think we should just avoid using it.
I had some issues with this elsewhere and added a more reliable (and understandable) way of doing minimum version checks:
|
<TargetFrameworkIsNet9OrGreater Condition="$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 9.0))">true</TargetFrameworkIsNet9OrGreater> |
We could potentially add TargetFrameworkIsNet8OrGreater as well and use that to conditionally enable Native support instead.
I think there might be a problem with how/when we enable the Native SDK. According to the docs
IsTargetFrameworkCompatiblereturns true if the "Candidate" (second argument) is compatible with the "Target" (first argument).These seem to be reversed here:
sentry-dotnet/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets
Line 23 in 084e3b4
If they're not reversed, that
IsTargetFrameworkCompatiblefunction is just plain confusing (and thus error prone) and I think we should just avoid using it.I had some issues with this elsewhere and added a more reliable (and understandable) way of doing minimum version checks:
sentry-dotnet/Directory.Build.props
Line 112 in 845de33
We could potentially add
TargetFrameworkIsNet8OrGreateras well and use that to conditionally enable Native support instead.