Skip to content

Add properties to disable implicit things - #17046

Merged
mattleibow merged 1 commit into
net7.0from
dev/disable-implicit
Aug 29, 2023
Merged

mattleibow merged 1 commit into
net7.0from
dev/disable-implicit

Conversation

@mattleibow

@mattleibow mattleibow commented Aug 29, 2023 •

Copy link
Copy Markdown
Member

Description of Change

Add two properties to allow disabling of things for various reasons:

  • DisableMauiImplicitPackageReferences will allow users to disable the package references and allow for updates (where possible)
  • DisableMauiImplicitFrameworkReferences will disable the implicit FrameworkReference items so potentially allowing for Essentials to be updated via NuGet

If you set these properties in your csproj, you will now have full control over the things that are added, so you will still need to do very similar versions. See more info in the issue.

But you can do something like this:

<ItemGroup>
	<FrameworkReference Include="Microsoft.Maui.Core" />
	<FrameworkReference Include="Microsoft.Maui.Controls" />
	<FrameworkReference Include="Microsoft.Maui.Essentials" />
</ItemGroup>

<ItemGroup>
	<PackageReference Include="Microsoft.Maui.Graphics" Version="$(MauiVersion)" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
	<PackageReference Include="Xamarin.Android.Glide" Version="4.13.2.2" />
	<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.4.0.3"  />
	<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.15" />
	<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.5.1.1" />
	<PackageReference Include="Xamarin.AndroidX.Navigation.Common" Version="2.5.2.1" />
	<PackageReference Include="Xamarin.AndroidX.Navigation.Fragment" Version="2.5.2.1" />
	<PackageReference Include="Xamarin.AndroidX.Navigation.Runtime" Version="2.5.2.1" />
	<PackageReference Include="Xamarin.AndroidX.Navigation.UI" Version="2.5.2.1" />
	<PackageReference Include="Xamarin.AndroidX.Security.SecurityCrypto" Version="1.1.0-alpha03" />
	<PackageReference Include="Xamarin.Google.Android.Material" Version="1.7.0" />
	<PackageReference Include="Xamarin.Google.Crypto.Tink.Android" Version="1.7.0.1" />
</ItemGroup>

@mattleibow

Copy link
Copy Markdown
Member Author

This will not work amazingly because of AndroidX and the constant type renames and moves: #12953 (comment)

However, if we can keep the net7.0 branch updated then maybe...

@jonathanpeppers jonathanpeppers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good. 👍

How will this change get to the main branch?

@mattleibow

Copy link
Copy Markdown
Member Author

It won't because main/net8 does not use these frameworks and nugets

@mattleibow
mattleibow merged commit 8938a80 into net7.0 Aug 29, 2023
@mattleibow
mattleibow deleted the dev/disable-implicit branch August 29, 2023 14:44
@mattleibow

Copy link
Copy Markdown
Member Author

/backport to release/7.0.2xx-sr8

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/7.0.2xx-sr8: https://github.com/dotnet/maui/actions/runs/6014603287

jonathanpeppers added a commit to jonathanpeppers/maui that referenced this pull request Sep 6, 2023
Context: https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management
Fixes: dotnet#12953

@mattleibow has already made a few changes to improve this scenario, by
introducing `$(DisableMauiImplicitPackageReferences)`.

I think the main thing missing is to change default values when
`$(ManagePackageVersionsCentrally)` is true. This setting, that enables
CPM, should automatically turn off all implicit `@(PackageReference)`.

I renamed `$(EnableMauiImplicitPackageReferences)` to
`$(DisableMauiImplicitPackageReferences)` to better align with the
changes we made in MAUI in .NET 7 for a future servicing release:

dotnet#17046

I tested these changes in a sample application here:

jdebache/repros@master...jonathanpeppers:MauiNuGetCPMRepro:peppers

I also updated `Workload/README.md` to have a section showing how to
setup NuGet CPM.
rmarinho pushed a commit that referenced this pull request Sep 7, 2023
Context: https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management
Fixes: #12953

@mattleibow has already made a few changes to improve this scenario, by
introducing `$(DisableMauiImplicitPackageReferences)`.

I think the main thing missing is to change default values when
`$(ManagePackageVersionsCentrally)` is true. This setting, that enables
CPM, should automatically turn off all implicit `@(PackageReference)`.

I renamed `$(EnableMauiImplicitPackageReferences)` to
`$(DisableMauiImplicitPackageReferences)` to better align with the
changes we made in MAUI in .NET 7 for a future servicing release:

#17046

I tested these changes in a sample application here:

jdebache/repros@master...jonathanpeppers:MauiNuGetCPMRepro:peppers

I also updated `Workload/README.md` to have a section showing how to
setup NuGet CPM.
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 7, 2023
@samhouts samhouts added the fixed-in-7.0.96 Look for this fix in 7.0.96 SR8! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

fixed-in-7.0.96 Look for this fix in 7.0.96 SR8!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants