Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Setup Maui.sln with a set of net6 projects #13433

Merged
merged 35 commits into from
Feb 10, 2021
Merged

Conversation

PureWeen
Copy link
Contributor

@PureWeen PureWeen commented Jan 17, 2021

Description of Change

  • Provision current NET6 SDKs that are listed here https://github.com/xamarin/net6-samples
  • Remove Sample.Mac because those are currently not being used
  • Setup a specific Maui.sln that only has net6 projects added
    • 16.9 P4 is required to build and run Maui.sln so this is why it's a bunch of separate projects
  • Modified our generic targets file to handle net6.0 TFMs
  • NET6 has additional rules about nullability which is why this PR also includes nullability fixes

Testing Procedure

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@PureWeen PureWeen requested a review from Redth January 17, 2021 16:23
build.cake Outdated Show resolved Hide resolved
build.cake Outdated Show resolved Hide resolved
NuGet.config Outdated
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PureWeen PureWeen changed the title [WiP] Net6 projects for .NET MAUI Setup Maui.sln with a set of net6 projects Feb 1, 2021
- template: common/controlgallery-android.yml

- stage: build_net6_windows
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These YAML steps were taken from here

https://github.com/xamarin/net6-samples/blob/main/azure-pipelines.yml

For installing the latest NET6 bits and such
At some point this will all get moved into easier to provision bits via the dotnet tool

<ItemGroup>
<ProjectReference Include="..\Sample\Sample-net6.csproj" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.4" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed so that the linker runs successfully against Essentials.

Nuget currently won't pull in all the correct dlls transitively since these are AndroidX dlls and not Net6

public class AppDelegate : FormsApplicationDelegate, IUIApplicationDelegate
#else
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting this out for now with NET6 targets because Platform.iOS is built against XA and not net6-ios

Once Platform.iOS is built against net6-ios then we can go back to FormsApplicationDelegate

@@ -22,7 +22,7 @@ public static void UpdateBackgroundColor(this UIView nativeView, IView view)

var color = view.BackgroundColor;

if (color != null && !color.IsDefault)
if (!color.IsDefault)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nullability checks inside NET6 throw a warning here because color will always be not null

@@ -38,7 +38,7 @@

<!-- Auto install any missing Android SDKs -->
<PropertyGroup Condition="'$(CI)' == 'true'">
<AndroidRestoreOnBuild Condition="'$(AndroidRestoreOnBuild)' == ''">True</AndroidRestoreOnBuild>
<AndroidRestoreOnBuild Condition="'$(AndroidRestoreOnBuild)' == ''">False</AndroidRestoreOnBuild>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property currently doesn't work with NET6

@PureWeen PureWeen marked this pull request as ready for review February 2, 2021 17:25

- powershell: |
& dotnet restore Maui.sln --configfile eng\DevopsNuget.config
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmarinho FYI


- bash: |
dotnet restore Maui.sln --configfile eng/DevopsNuget.config &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmarinho FYI

@PureWeen PureWeen merged commit 9fe1b41 into main-handler Feb 10, 2021
@PureWeen PureWeen deleted the net6_projects branch February 10, 2021 22:24

<!-- iOS -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0-ios' ">
<DefineConstants>$(DefineConstants);IOS</DefineConstants>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be defined by default in .NET 6. Is it not?


<!-- Android -->
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-android'))">
<DefineConstants>$(DefineConstants);MONOANDROID</DefineConstants>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use the ANDROID define instead, it is there by default in .NET 6.

## Maui.sln

### SDKS required
- Install the SDKs listed here https://github.com/xamarin/net6-samples
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We moved the repo to dotnet/net6-mobile-samples

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants