2019-05-22 03:06:59 +03:00
|
|
|
<Project>
|
2021-02-23 02:40:04 +03:00
|
|
|
<Import Condition="'$(SampleProject)' != 'true' and '$(CI)' == 'true'" Project="eng\Git.Build.targets" />
|
2021-04-15 21:49:21 +03:00
|
|
|
<Import Condition="'$(SampleProject)' != 'true' and '$(CI)' == 'true' " Project="eng\Versions.targets" />
|
Use .NET 6 AndroidX packages & consolidate versions (#13879)
Bump to Microsoft.Android.Sdk 11.0.200.118. This is needed for a fix
to support net6.0-android NuGet packages.
We have new AndroidX packages:
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.2.0.7-net6preview01" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.3.0.1-net6preview01" />
These are available on the same feed we have the iOS/Android runtime
packs for .NET 6:
<add key="xamarin" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />
These packs support both Xamarin.Android & .NET 6 because they contain
both sets of assemblies, such as:
* `lib/monoandroid90/Xamarin.AndroidX.*.dll`
* `lib/net6.0-android/Xamarin.AndroidX.*.dll`
To consolidate our AndroidX package versions, we can a new MSBuild
pattern for declaring NuGet package versions that
dotnet/project-system uses:
https://github.com/dotnet/project-system/blob/accdee5926eb32f51ee503cba355cb1f4f991459/Directory.Build.targets#L3
https://github.com/dotnet/project-system/blob/accdee5926eb32f51ee503cba355cb1f4f991459/build/import/Packages.targets
1. List packages in `.csproj` files as they are needed. But leave off
`%(Version)` completely.
2. A `Directory.Build.targets` somewhere does: `<PackageReference
Update="YourPackage" Version="1.0.0" />` This allows you to put the
version in one place, and you don't need to check platforms or
anything, because the `Update` doesn't do anything if the `.csproj`
file isn't using that package.
We could do this pattern across the whole Maui repo, but I just set
this up for the `AndroidX` and `Microsoft.Extensions` packages for
now.
~~ .NET 6 Linker ~~
Since we are using .NET 6 AndroidX packages, the following workaround
is no longer needed, so I removed them:
<PropertyGroup>
<_DotNetPackageVersion>6.0.0-preview.2.21110.7</_DotNetPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.CodeDom" Version="$(_DotNetPackageVersion)" />
<PackageReference Include="System.Diagnostics.EventLog" Version="$(_DotNetPackageVersion)" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="$(_DotNetPackageVersion)" />
<PackageReference Include="System.IO.Ports" Version="$(_DotNetPackageVersion)" />
<PackageReference Include="System.Security.Permissions" Version="$(_DotNetPackageVersion)" />
<PackageReference Include="System.Threading.AccessControl" Version="$(_DotNetPackageVersion)" />
</ItemGroup>
Previously, the AndroidX packages were Xamarin.Android libraries, and
they would cause the linker to crash in `Release` builds:
ILLink : error IL1012: IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues
Fatal error in IL Linker
Unhandled exception. Mono.Linker.InternalErrorException: Step 'LoadReferencesStep' failed when processing assembly 'Maui.Controls.Sample.SingleProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
---> Mono.Linker.LinkerFatalErrorException: ILLink: error IL1010: Assembly 'Maui.Controls.Sample.SingleProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' cannot be loaded due to failure in processing 'Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' reference
---> Mono.Linker.LinkerFatalErrorException: ILLink: error IL1010: Assembly 'Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' cannot be loaded due to failure in processing 'Xamarin.AndroidX.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' reference
---> Mono.Linker.LinkerFatalErrorException: ILLink: error IL1010: Assembly 'Xamarin.AndroidX.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' cannot be loaded due to failure in processing 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' reference
---> Mono.Linker.LinkerFatalErrorException: ILLink: error IL1009: Assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' reference 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' could not be resolved
---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
---> System.IO.FileNotFoundException: Unable to find 'System.Security.Permissions.dll' or 'System.Security.Permissions.exe' file
~~ AndroidX obsoleted FragmentStatePagerAdapter ~~
Initially I got several warnings (that became errors), such as:
error CS0618: 'FragmentStatePagerAdapter' is obsolete...
I don't know what should be done here, so I ignored the warning in the
two files that have a problem for now:
#pragma warning disable 618
2021-03-02 02:25:45 +03:00
|
|
|
<Import Project="eng\AndroidX.targets" />
|
|
|
|
<Import Project="eng\Microsoft.Extensions.targets" />
|
[build] Update to .NET 6 Preview 4 (#796)
* [build] Update to .NET 6 Preview 4
Brings in Preview 4 updates for the Android, MaciOS, and .NET SDks.
Initial build attempts were failing with hundreds of errors:
D:\a\1\s\src\Essentials\src\Connectivity\Connectivity.ios.tvos.macos.cs(12,70): error BI1234: 'CTCellularData' is obsolete: 'Starting with ios14.0 Use the 'CallKit' API instead.' [D:\a\1\s\src\Essentials\src\Essentials-net6.csproj]
D:\a\1\s\src\Essentials\src\Compass\Compass.ios.cs(31,6): error CA1416: This call site is reachable on: 'iOS' 13.6 and later. 'CLLocationManager.HeadingFilter' is only supported on: 'macos' 11.0 and later. [D:\a\1\s\src\Essentials\src\Essentials-net6.csproj]
D:\a\1\s\src\Core\src\Platform\MaciOS\ColorExtensions.cs(64,13): error CA1416: This call site is reachable on: 'MacCatalyst' 13.5 and later. 'UIColor.SystemBackgroundColor.get' is supported on: 'ios' 13.0 and later. [D:\a\1\s\src\Core\src\Core-net6.csproj]
CSC : error AD0001: Analyzer 'Microsoft.NetCore.Analyzers.InteropServices.PlatformCompatibilityAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. [D:\a\1\s\src\BlazorWebView\src\core\Microsoft.AspNetCore.Components.WebView.Maui.csproj]
The [platform compatibility analyzer][0] has been disabled for now, and
it can be enabled locally to work through the few hundred errors in
future PRs.
Once these issues were sorted, there were a handful of other breaks
that I've attempted to fix:
D:\a\1\s\src\Essentials\src\AssemblyInfo\AssemblyInfo.ios.tvos.watchos.macos.cs(3,12): error CS0618: 'LinkerSafeAttribute' is obsolete: 'Replace with '[assembly: System.Reflection.AssemblyMetadata ("IsTrimmable", "True")]'.' [D:\a\1\s\src\Essentials\src\Essentials-net6.csproj]
D:\a\1\s\src\Compatibility\Core\src\iOS\Renderers\TabbedRenderer.cs(422,33): error CS1503: Argument 1: cannot convert from 'UIKit.UIStringAttributes' to 'UIKit.UITextAttributes' [D:\a\1\s\src\Compatibility\Core\src\Compatibility-net6.csproj]
D:\a\1\s\src\Compatibility\Core\src\iOS\CollectionView\CarouselViewController.cs(106,23): error CS0114: 'CarouselViewController.DraggingStarted(UIScrollView)' hides inherited member 'UICollectionViewController.DraggingStarted(UIScrollView)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. [ D:\a\1\s\src\Compatibility\Core\src\Compatibility-net6.csproj]
D:\a\1\s\src\Compatibility\Core\src\iOS\CollectionView\CarouselViewController.cs(117,23): error CS0114: 'CarouselViewController.DraggingEnded(UIScrollView, bool)' hides inherited member 'UICollectionViewController.DraggingEnded(UIScrollView, bool)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. [ D:\a\1\s\src\Compatibility\Core\src\Compatibility-net6.csproj]
Finally it seems JDK 14 was being preferred on macOS machines in CI, so
I've set `$(JI_JAVA_HOME)` to the [pre-installed JDK 11][1].
[0]: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1416
[1]: https://github.com/actions/virtual-environments/blob/macOS-10.15/20210419.2/images/macos/macos-10.15-Readme.md#java
* Apply feedback, bump p4 bits, provision xcode 12.5 rc
* Use Big Sur pool, clean up duplicate variable declaration
* Revert "Use Big Sur pool, clean up duplicate variable declaration"
This reverts commit b91482e10cdef99158e9060c9bf51298a74d89a8.
* Disable linker for ios and catalyst
Co-authored-by: Rui Marinho <me@ruimarinho.net>
2021-04-24 13:32:18 +03:00
|
|
|
|
|
|
|
<!-- Temporarily disable the linker for net6.0-ios and net6.0-maccatalyst until we get machine pools with Big Sur and Xcode 12.5 is stable -->
|
|
|
|
<PropertyGroup>
|
|
|
|
<PublishTrimmed Condition=" '$(TargetFramework)' == 'net6.0-ios' or '$(TargetFramework)' == 'net6.0-maccatalyst' ">false</PublishTrimmed>
|
|
|
|
</PropertyGroup>
|
|
|
|
|
2021-04-30 22:43:25 +03:00
|
|
|
<Target Name="Net6WinUIPackagingWorkaround" BeforeTargets="GetPackagingOutputs" Condition="$(TargetFramework.Contains('-windows')) == true AND '$(DisableEmbeddedXbf)' != 'true' ">
|
|
|
|
<PropertyGroup>
|
|
|
|
<TargetPlatformIdentifierAdjusted>UAP</TargetPlatformIdentifierAdjusted>
|
|
|
|
<_SupportEmbedFileResources>true</_SupportEmbedFileResources>
|
|
|
|
<_EmbedFileResfilePath>$(IntermediateOutputPath)$(AppxSubfolderWithFilesToBeEmbedded)\embed.resfiles</_EmbedFileResfilePath>
|
|
|
|
</PropertyGroup>
|
|
|
|
</Target>
|
|
|
|
</Project>
|