Skip to content

Conversation

@jonathanpeppers
Copy link
Member

Context: dotnet/maui#3018 (review)

In order for the .NET MAUI workload to properly implement implicit
global usings:

  1. The .NET MAUI workload will add many @(Using) entries that
    conflict with each platform's APIs.

  2. We need something to identify @(Using) is for a specific
    platform, so we can use a new %(Platform) metadata for this.

  3. Late in .NET MAUI's MSBuild targets, we can do:

<ItemGroup Condition=" '$(UseMaui)' == 'true' and ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable') ">
  <Using Remove="@(Using->HasMetadata('Platform'))" />
</ItemGroup>

In .NET 7, we might have a nicer design around this, but for now this
is the plan for .NET 6.

Context: dotnet/maui#3018 (review)

In order for the .NET MAUI workload to properly implement implicit
global usings:

1. The .NET MAUI workload will add many `@(Using)` entries that
   conflict with each platform's APIs.

2. We need *something* to identify `@(Using)` is for a specific
   platform, so we can use a new `%(Platform)` metadata for this.

3. Late in .NET MAUI's MSBuild targets, we can do:

    <ItemGroup Condition=" '$(UseMaui)' == 'true' and ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable') ">
      <Using Remove="@(Using->HasMetadata('Platform'))" />
    </ItemGroup>

In .NET 7, we might have a nicer design around this, but for now this
is the plan for .NET 6.
@jonathanpeppers jonathanpeppers merged commit 4a958fc into dotnet:main Nov 1, 2021
@jonathanpeppers jonathanpeppers deleted the maui-implicit-global-usings branch November 1, 2021 21:12
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
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.

2 participants