I only want to make a project for MacOS and Windows, no need for Android or iOS. I tried deleting the platforms from the folder called "Platforms" but they seem to regenerate each compile. Is there an official method for only targeting the platforms that are necessary? I looked at multiple project files, but there are Android and iOS tags scattered throughout.
Can someone please help me with this?
In your .csproj
file, remove the targets for the platforms you aren't building for, reducing it to the following:
<TargetFrameworks>net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
In your .csproj
file, remove the supported version information for the platforms you aren't building for, reducing it to the following:
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
Delete any subdirectories under the Platforms
folder for the platforms you aren't building for.