maui/Directory.Build.targets

137 строки
6.5 KiB
XML

<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<ItemGroup>
<!-- Upgrade xunit's transitive NETStandard.Library dependency to avoid .NET Standard 1.x dependencies. -->
<!-- <PackageReference Include="NETStandard.Library"
IsImplicitlyDefined="false"
PrivateAssets="all"
ExcludeAssets="runtime"
VersionOverride="2.0.3"
Condition="'$(TargetFrameworkIdentifier)' != '.NETStandard' and
$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.0'))" /> -->
</ItemGroup>
<Import Condition="'$(SampleProject)' != 'true'" Project="eng\Versions.targets" />
<Import Condition="'$(SampleProject)' != 'true' and '$(IsTestProject)' != 'true'" Project="eng\BannedApis.targets" />
<Import Project="eng\AndroidX.targets" />
<Import Project="eng\NuGetVersions.targets" />
<PropertyGroup>
<!-- Allows for MAUI Xaml Hot Reload Samples to run without checks -->
<IgnoreMauiXamlHotReloadCompatibilityCheck>True</IgnoreMauiXamlHotReloadCompatibilityCheck>
</PropertyGroup>
<PropertyGroup>
<!-- Microsoft.Build.Msix.props" cannot be imported again -->
<!-- Found version-specific or distribution-specific runtime identifier(s)-->
<NoWarn>$(NoWarn);MSB4011;NETSDK1206</NoWarn>
</PropertyGroup>
<!-- platform version number information -->
<PropertyGroup Condition="'$(_MauiTargetPlatformIsiOS)' == 'True'">
<SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>13.0</TargetPlatformMinVersion>
<!-- Workaround: https://github.com/dotnet/roslyn-analyzers/issues/6158 -->
<NoWarn>$(NoWarn);CA1416</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(_MauiTargetPlatformIstvOS)' == 'True'">
<SupportedOSPlatformVersion>10.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>10.0</TargetPlatformMinVersion>
<!-- Workaround: https://github.com/dotnet/roslyn-analyzers/issues/6158 -->
<NoWarn>$(NoWarn);CA1416</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(_MauiTargetPlatformIsMacCatalyst)' == 'True'">
<SupportedOSPlatformVersion>15.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>15.0</TargetPlatformMinVersion>
<!-- Workaround: https://github.com/dotnet/roslyn-analyzers/issues/6158 -->
<NoWarn>$(NoWarn);CA1416</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(_MauiTargetPlatformIsmacOS)' == 'True'">
<SupportedOSPlatformVersion>12.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>12.0</TargetPlatformMinVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(_MauiTargetPlatformIsAndroid)' == 'True'">
<SupportedOSPlatformVersion>21.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>21.0</TargetPlatformMinVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(_MauiTargetPlatformIsTizen)' == 'True'">
<SupportedOSPlatformVersion>6.5</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>6.5</TargetPlatformMinVersion>
</PropertyGroup>
<!--
NOTE: The Contains('-windows10') is a bit of a hack
because we don't want to set these properties for WPF projects...
There's probably a better way we should find to infer this
-->
<PropertyGroup Condition="'$(_MauiTargetPlatformIsWindows)' == 'True' AND $(TargetFramework.Contains('-windows10'))">
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>
<!--
Disable generation of obj/Debug/net8.0-android/__Microsoft.Android.Resource.Designer.cs
Enable this individually in projects that declare/use AndroidResource IDs.
-->
<PropertyGroup Condition="'$(_MauiTargetPlatformIsAndroid)' == 'True' AND '$(AndroidApplication)' != 'true' AND '$(MauiGenerateResourceDesigner)' != 'true'">
<AndroidGenerateResourceDesigner>false</AndroidGenerateResourceDesigner>
<AndroidUseIntermediateDesignerFile Condition="$(TargetFramework.StartsWith('$(_MauiPreviousDotNetTfm)'))">false</AndroidUseIntermediateDesignerFile>
</PropertyGroup>
<!-- semi HACK: by default, WinUI includes all @(None) with .bmp/.png as @(Content) and adds that to the .pri -->
<ItemGroup Condition="'$(_MauiTargetPlatformIsWindows)' == 'True'">
<Content Remove="@(None->WithMetadataValue('Pack','true'))" />
</ItemGroup>
<!--
Workaround for https://github.com/microsoft/WindowsAppSDK/issues/2684
-->
<Import Project="src\Core\src\nuget\buildTransitive\WinUI.targets" Condition=" '$(WindowsPackageType)' == 'None' and '$(_MauiTargetPlatformIsWindows)' == 'True' " />
<!--
Workaround for https://github.com/MicrosoftEdge/WebView2Feedback/issues/2898
-->
<!-- Remove all 'WebView2Loader.dll' items to fix a build error -->
<Target Name="RemoveWebView2LoaderDllFromPackagingOutputs" BeforeTargets="_ComputeAppxPackagePayload">
<ItemGroup>
<WebView2LoaderDllPackagingOutput Include="@(PackagingOutputs)" Condition="'%(PackagingOutputs.Filename)%(PackagingOutputs.Extension)' == 'WebView2Loader.dll'" />
</ItemGroup>
<ItemGroup Condition="'@(WebView2LoaderDllPackagingOutput)' != ''">
<PackagingOutputs Remove="@(WebView2LoaderDllPackagingOutput)" />
</ItemGroup>
</Target>
<!-- NuGet package information -->
<PropertyGroup Condition="'$(IsPackable)' == 'true'">
<PackageTags Condition="'$(PackageTags)' == ''">$(DefaultPackageTags)</PackageTags>
<GenerateNuspecDependsOn>
_MauiPackReadmeFile;
$(GenerateNuspecDependsOn);
</GenerateNuspecDependsOn>
</PropertyGroup>
<ItemGroup Condition="'$(IsPackable)' == 'true'">
<None Include="$(LicenseFile)"
PackagePath="$([System.IO.Path]::GetFileName('$(LicenseFile)'))"
Pack="true" />
<None Include="$(PackageThirdPartyNoticesFile)"
PackagePath="$([System.IO.Path]::GetFileName('$(PackageThirdPartyNoticesFile)'))"
Pack="true" />
</ItemGroup>
<Target Name="_MauiPackReadmeFile" Condition="'$(IsPackable)' == 'true' and '$(PackageReadmeFile)' == ''">
<PropertyGroup>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<WriteLinesToFile File="$(IntermediateOutputPath)\$(PackageReadmeFile)"
Lines="$(Description)"
Overwrite="true" />
<ItemGroup>
<_PackageFiles Include="$(IntermediateOutputPath)\$(PackageReadmeFile)"
PackagePath="$(PackageReadmeFile)"
Pack="true" />
</ItemGroup>
</Target>
</Project>