Repository navigation
[msbuild] fix NuGet Central Package Management (CPM) - #17235
Conversation
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.
|
I can't review, but looking at the results in the repro, it seems like it does what it's expected to, i.e. allow overriding implicit package references from |
|
@jonathanpeppers Could your write a complete documentation on how to use CPM with MAUI please ? The example you provided doesn't seem to work as provided. I bit more explanation would be welcome 😄 |
What errors do yout get? It might be easy for you to create a new MAUI project here on Github and point us there. CPM works for me so I can probably spot an issue. Then it would serve as a documentation or source for documentation efforts. |
|
Hi @MartyIX Here is my Directory.Packages.props Here is my MAUI .csproj file, for nuget references : I'm getting NU1008 error : Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: PackageId. Maybe I'm missing a little something inside my .csproj ! Edit : My Directory.Packages.props is used by other desktop projects without any issue |
|
The error says you have a |
|
Hi @jonathanpeppers, |
|
One of the downfalls of CPM, is they have no way to give a line number where the item group is... It's just an MSBuild item group and it's not currently possible in an MSBuild task to find the line number an item originated from. |
|
At least the binlog viewer is useful for this ! Thank you for your help |
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.mdto have a section showing how to setup NuGet CPM.