[workload] Remove Microsoft.Maui.Extensions pack#5918
[workload] Remove Microsoft.Maui.Extensions pack#5918jonathanpeppers merged 5 commits intodotnet:net7.0from
Conversation
Reduces the number of nupkgs and msi files we produce and distribute by combining the Microsoft.Maui.Dependencies and Microsoft.Maui.Extensions library packs into one.
0028545 to
3b89855
Compare
| </ItemGroup> | ||
| <ItemGroup Condition=" '$(UseMaui)' == 'true' or '$(UseMauiCore)' == 'true' or '$(UseMauiEssentials)' == 'true' "> | ||
| <PackageReference Include="Microsoft.Maui.Dependencies" Version="$(MauiVersion)" IsImplicitlyDefined="true" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
@mattleibow and @jonathanpeppers I had a question around $(UseMauiEssentials)=true, as I am not too familiar with where/how that is used. It seems that projects that set this property to true will now get Microsoft.Extensions package references by default through Microsoft.Maui.Dependencies, but this may not be any different from how things are set up today? Are there cases where a project could be using $(UseMauiEssentials)=true without them using the MAUI workload or also setting $(UseMaui) to true?
There was a problem hiding this comment.
If you did dotnet new android and then UseMauiEssentials=true, it would be like using Xamarin.Essentials without Xamarin.Forms.
With this change, you'd also get Microsoft.Extensions packages, but it seems like that would be OK?
There was a problem hiding this comment.
Not sure... There is a lot of extra things now I suppose such as the logging, config and more.
I suppose the linker will remove it?
What happens when we switch to library packs and no longer use this nuget?
There was a problem hiding this comment.
I suppose the linker will remove it?
It looks like Microsoft.Extensions takes up ~148kb uncompressed in a dotnet new maui app. It doesn't look like they are marked as trimmable yet.
But I think if the app doesn't use them at all, they would get dropped? csc would exclude them?
What happens when we switch to library packs and no longer use this nuget?
I think this change actually helps this, as you are getting rid of a pack.
|
I tried to get some more info around possible app size implications for the Essentials case. I took the example of creating a dotnet new android project, setting UseMauiEssentials=true, and adding a really simple Barometer example to the template. File sizes for a Release build are near identical:
A binlog also seems to show that these extra references are being removed by ILLink in this scenario, and they are not included in the |
src/Workload/Microsoft.Maui.Dependencies/Microsoft.Maui.Dependencies.csproj
Outdated
Show resolved
Hide resolved
|
@mattleibow @jonathanpeppers I'm not sure if we want to hold this until .NET 7 at this point? I think it should be ready now though. |
|
@mattleibow @rmarinho @jonathanpeppers is main open for .NET 7 related things like this? I think we should be good to merge this, unless there is a separate .NET 7 branch that this should go to instead? |
|
Should we put it on the |
|
No conflicts after changing the base to net7.0 if we want to merge it there. I assume net7.0 will merge back into main eventually? |
Reduces the number of nupkgs and msi files we produce and distribute by
removing the Microsoft.Maui.Extensions library pack.
Instead the packages are added via:
--<PackageReference Include="Microsoft.Maui.Extensions" Version="$(MauiVersion)" IsImplicitlyDefined="true" />
++<PackageReference Include="Microsoft.Extensions.Configuration" Version="@MicrosoftExtensionsServicingPackageVersion@" IsImplicitlyDefined="true" />
++<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="@MicrosoftExtensionsPackageVersion@" IsImplicitlyDefined="true" />
++<PackageReference Include="Microsoft.Extensions.Logging" Version="@MicrosoftExtensionsPackageVersion@" IsImplicitlyDefined="true" />
++<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="@MicrosoftExtensionsServicingPackageVersion@" IsImplicitlyDefined="true" />
So projects that only have `UseMauiEssentials` won't get these packages, the behavior
should be the same, we just dropped 1 pack.
# Conflicts:
# src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets

Reduces the number of nupkgs and msi files we produce and distribute by
moving the PackageReferences declared in Microsoft.Maui.Extensions to
BundledVersions.targets