Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[workload] support $(UseMaui) from a net6.0 TFM #1788

Merged
merged 7 commits into from
Jul 27, 2021

Conversation

jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Jul 23, 2021

Description of Change

If you try to enable $(UseMaui) in a net6.0 project, you get
errors during restore like:

error NU1101: Unable to find package Microsoft.Maui.Core.Ref.. No packages exist with this id in source(s):
C:\src\maui\bin\dotnet\library-packs, dotnet-eng, dotnet-public, dotnet6, xamarin

Note the .. is caused by $(_MauiPlatformName) being blank in
BundledVersions.targets.

The solution here is to add an any pack for all .Ref and .Runtime
packs. Unfortunately, we will need net6.0 versions of all assemblies
in order to do this.

This is blocked until net6.0 can be added to $(MauiPlatforms):

<MauiPlatforms>net6.0-ios;net6.0-maccatalyst;net6.0-android</MauiPlatforms>

I would do it myself, but there are many C# compiler errors I don't
know about. It appears that the $(DefineConstants) in place expect
some platform to be there.

The remaining changes here should get net6.0 working in a
workload, but I can't test it yet.

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)
  • Targets a single property for a single control (or intertwined few properties)
  • Adds the property to the appropriate interface
  • Avoids any changes not essential to the handler property
  • Adds the mapping to the PropertyMapper in the handler
  • Adds the mapping method to the Android, iOS, and Standard aspects of the handler
  • Implements the actual property updates (usually in extension methods in the Platform section of Core)
  • Tags ported renderer methods with [PortHandler]
  • Adds an example of the property to the sample project (MainPage)
  • Adds the property to the stub class
  • Implements basic property tests in DeviceTests

Does this PR touch anything that might affect accessibility?

No

If you try to enable `$(UseMaui)` in a `net6.0` project, you get
errors during `restore` like:

    error NU1101: Unable to find package Microsoft.Maui.Core.Ref.. No packages exist with this id in source(s):
    C:\src\maui\bin\dotnet\library-packs, dotnet-eng, dotnet-public, dotnet6, xamarin

Note the `..` is caused by `$(_MauiPlatformName)` being blank in
`BundledVersions.targets`.

The solution here is to an `any` pack for all `.Ref` and `.Runtime`
packs. Unfortunately, we will need `net6.0` versions of all assemblies
in order to do this.

This is blocked until `net6.0` can be added to `$(MauiPlatforms)`:

https://github.com/dotnet/maui/blob/f95c2e5c9a6e19817c75ddb93fae98ca8739399f/Directory.Build.props#L13

I would do it myself, but there are many C# compiler errors I don't
know about. It appears that the `$(DefineConstants)` in place expect
some platform to be there.

The remaining changes here *should* get `net6.0` working in a
workload, but I can't test it yet.
@jonathanpeppers
Copy link
Member Author

I think this can be finished when this lands: #1359

@mattleibow is going to add the net6.0 TFM.

@Redth Redth added this to the 6.0.100-preview.7 milestone Jul 23, 2021
@profix898
Copy link

Will solve #1734 and #1739 ...

@mattleibow
Copy link
Member

My PR is almost green. Just gotta fix some of the weirdness in the CI and then we can merge. I'll rebase this.

@jonathanpeppers
Copy link
Member Author

This probably won’t work first try, the build actually couldn’t get that far because the .dll files it needs are missing.

Just let me know and I’ll try it out.

@mattleibow
Copy link
Member

I updated this PR and also removed the sample project. The main sample project is not net6.0 compatible and builds locally. So this PR should be adding the any and the samples should build on CI.

@jonathanpeppers
Copy link
Member Author

Should this section just always include net6.0:

<TargetFrameworks>$(MauiPlatforms)</TargetFrameworks>
<TargetFrameworks Condition=" '$(UseMaui)' != 'true' ">net6.0;$(TargetFrameworks)</TargetFrameworks>

I don't understand how main works right now, if this is here? The NoPlatform sample I had reproduced the issue -- and it doesn't seem like we have a project like that now?

@jonathanpeppers
Copy link
Member Author

jonathanpeppers commented Jul 27, 2021

Ok, I see this only would break if we are using the workload with $(UseMaui):

<TargetFrameworks>$(MauiPlatforms)</TargetFrameworks>
<TargetFrameworks Condition=" '$(UseMaui)' != 'true' ">net6.0;$(TargetFrameworks)</TargetFrameworks>

@(ProjectReference) would work fine.

So we should remove this here, thanks.

@jonathanpeppers
Copy link
Member Author

Seems to be working, in general:

  Installing pack Microsoft.Maui.Core.Ref.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Writing workload pack installation record for Microsoft.Maui.Core.Ref.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Installing pack Microsoft.Maui.Core.Runtime.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Writing workload pack installation record for Microsoft.Maui.Core.Runtime.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Installing pack Microsoft.Maui.Controls.Ref.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Writing workload pack installation record for Microsoft.Maui.Controls.Ref.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Installing pack Microsoft.Maui.Controls.Runtime.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Writing workload pack installation record for Microsoft.Maui.Controls.Runtime.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Installing pack Microsoft.Maui.Essentials.Ref.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Writing workload pack installation record for Microsoft.Maui.Essentials.Ref.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Installing pack Microsoft.Maui.Essentials.Runtime.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...
  Writing workload pack installation record for Microsoft.Maui.Essentials.Runtime.any version 6.0.100-preview.7.5661+pr.1788-sha.eb8ada7b3-azdo.43629...

But then if I look at the .binlog, the "design" assemblies are in the wrong folder:

image

I think the *.DesignTools.dll files need to be in a Design subfolder. Will look into this.

Otherwise, they get included as references.
@jonathanpeppers
Copy link
Member Author

This looks right now the "design" assemblies aren't referenced anymore:

image

@jonathanpeppers jonathanpeppers marked this pull request as ready for review July 27, 2021 15:00
@mattleibow mattleibow merged commit 9e9c44a into dotnet:main Jul 27, 2021
@jonathanpeppers jonathanpeppers deleted the workload-net6.0 branch July 27, 2021 15:17
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
@samhouts samhouts added the fixed-in-6.0.100-preview.7.3 Look for this fix in 6.0.100-preview.7.3! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.100-preview.7.3 Look for this fix in 6.0.100-preview.7.3!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants