我只想为MacOS和Windows做一个项目,不需要Android或iOS.我try 从名为"platforms"的文件夹中删除平台,但它们似乎会重新生成每个编译.是否有官方方法仅针对必要的平台?我查看了多个项目文件,但到处都是Android和iOS标记.
谁能帮我一下吗?
我只想为MacOS和Windows做一个项目,不需要Android或iOS.我try 从名为"platforms"的文件夹中删除平台,但它们似乎会重新生成每个编译.是否有官方方法仅针对必要的平台?我查看了多个项目文件,但到处都是Android和iOS标记.
谁能帮我一下吗?
在您的.csproj
文件中,删除不为其构建的平台的目标,将其减少为以下内容:
<TargetFrameworks>net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
在您的.csproj
文件中,删除不为其构建的平台的支持版本信息,将其减少为以下内容:
<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>
删除Platforms
文件夹下的所有子目录,这些子目录用于您不为其构建的平台.