Skip to content
Merged
5 changes: 4 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@
<!-- Helpful properties used elsewhere -->
<PropertyGroup>
<TargetFrameworkVersion>$([MSBuild]::GetTargetFrameworkVersion($(TargetFramework)))</TargetFrameworkVersion>
<TargetFrameworkIsNet9OrGreater Condition="$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 9.0))">true</TargetFrameworkIsNet9OrGreater>
<IsNet8OrGreater>false</IsNet8OrGreater>
<IsNet8OrGreater Condition="$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 8.0))">true</IsNet8OrGreater>
<IsNet9OrGreater>false</IsNet9OrGreater>
<IsNet9OrGreater Condition="$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 9.0))">true</IsNet9OrGreater>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Sentry/Platforms/Native/Sentry.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</None>
</ItemGroup>

<Target Name="CleanNativeSDK" BeforeTargets="CoreClean" Condition="'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0'">
<Target Name="CleanNativeSDK" BeforeTargets="CoreClean" Condition="'$(IsNet8OrGreater)' == 'true'">
<Message Text="Inside Custom Clean" Importance="high"/>
<RemoveDir Directories="$(SentryNativeOutputDirectory)" />
<RemoveDir Directories="$(SentryNativeSourceDirectory)build" />
Expand All @@ -86,7 +86,7 @@
built already on each native platform and fetched for the final .net build. -->
<Target Name="_BuildSentryNativeSDK"
BeforeTargets="DispatchToInnerBuilds;BeforeBuild"
Condition="('$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0') and '$(CI)' != 'true'"
Condition="'$(IsNet8OrGreater)' == 'true' and '$(CI)' != 'true'"
Inputs="$(SentryNativeBuildInputs)"
Outputs="$(SentryNativeBuildOutputs)">
<!-- We want a "-Clean" because if the build script changes, previous cmake cache may contain invalid defines. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<PropertyGroup>
<!-- net8.0 or greater -->
<FrameworkSupportsNative Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0')) and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true</FrameworkSupportsNative>
<FrameworkSupportsNative Condition="'$(IsNet8OrGreater)' == 'true' and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true</FrameworkSupportsNative>
<!-- Make it opt-out -->
<FrameworkSupportsNative Condition="'$(SentryNative)' == 'false' or '$(SentryNative)' == 'disable'">false</FrameworkSupportsNative>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<!-- Visual tests need net9.0+ mobile and are flaky when using the headless runner on CI -->
<EnableMauiDeviceTestVisualRunner>false</EnableMauiDeviceTestVisualRunner>
<EnableMauiDeviceTestVisualRunner Condition="'$(TargetFrameworkIsNet9OrGreater)' == 'true' AND '$(PlatformIsMobile)' == 'true' AND '$(ContinuousIntegrationBuild)' != 'true'">true</EnableMauiDeviceTestVisualRunner>
<EnableMauiDeviceTestVisualRunner Condition="'$(IsNet9OrGreater)' == 'true' AND '$(PlatformIsMobile)' == 'true' AND '$(ContinuousIntegrationBuild)' != 'true'">true</EnableMauiDeviceTestVisualRunner>
</PropertyGroup>
<!--
Workaround for Verify issue with scrubbing when running in Rider on Windows.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<ProjectReference Include="..\Sentry.Tests\Sentry.Tests.csproj"/>
<ProjectReference Include="..\Sentry.Extensions.Logging.Tests\Sentry.Extensions.Logging.Tests.csproj"/>
<ProjectReference Include="..\Sentry.Maui.Tests\Sentry.Maui.Tests.csproj"/>
<ProjectReference Include="..\Sentry.Maui.CommunityToolkit.Mvvm.Tests\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj" Condition="'$(TargetFrameworkIsNet9OrGreater)' == 'true'"/>
<ProjectReference Include="..\Sentry.Maui.CommunityToolkit.Mvvm.Tests\Sentry.Maui.CommunityToolkit.Mvvm.Tests.csproj" Condition="'$(IsNet9OrGreater)' == 'true'"/>
</ItemGroup>

</Project>
Loading