You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MAUI is not compatible with ManagePackageVersionsCentrally #27840
When using NuGet Central Package Management and MAUI installed, we get the following error:
error NU1507: There are 2 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source. The following sources are defined: https://pkgs.dev.azure.com/..., C:\Program Files\dotnet\library-packs
To Reproduce
Install MAUI
Enable CPS by adding a Directory.Packages.props file with <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
It's not enough to do this if you actually want CPM in your projects; you need the undocumented DisableImplicitLibraryPacksFolder property added to your Directory.Packages.props (or other project file). This is mentioned in #28642.
Personally, I've never used MAUI - think I may have inadvertently installed it on my Mac as part of Visual Studio for Mac (now uninstalled since it's been discontinued) but it's left detritus on my machine I'm not sure how to clean properly. This fixed it for me:
The workaround mentioned by @james-world works for me, below you see the snippets.
I can use central package management like that in the referenced non maui and the test projects.
Not what I desired but hopefully this gets soon fixed.
Activity
KalleOlaviNiemitalo commentedon Oct 19, 2022
May be a duplicate of NuGet/Home#11951.
nickrandolph commentedon Oct 25, 2022
@jeffkl any thoughts on this? If related to NuGet/Home#11951, when are we likely to see this fix being widely available?
jeffkl commentedon Oct 25, 2022
@nickrandolph the change shipped with Visual Studio 2022 17.4 and .NET SDK 6.0.4xx
KalleOlaviNiemitalo commentedon Oct 25, 2022
This issue is still reproducible with .NET SDK 6.0.402, which includes NuGet 6.3.1-rc.1+01bc4df1ef99c9c213f892ec8b25e46b23c7cfb1.01bc4df1ef99c9c213f892ec8b25e46b23c7cfb1 (see NuGet/Home#11974 for the strange versioning). https://github.com/NuGet/NuGet.Client/blob/01bc4df1ef99c9c213f892ec8b25e46b23c7cfb1/src/NuGet.Core/NuGet.Commands/RestoreCommand/RestoreCommand.cs#L466 does not include the changes that were made in NuGet/NuGet.Client#4764. @jeffkl, did you mean some other change?
jeffkl commentedon Oct 25, 2022
@KalleOlaviNiemitalo okay sorry at some point NuGet stopped inserting into .NET 6. So I'd imagine the change is only in .NET 7 RC1 and above.
ganeshkhatri commentedon Nov 26, 2023
The issue is again raised in dotnet 8.0. Works fine with dotnet 7.0.
Sen-Gupta commentedon Feb 4, 2024
Issue occurs in .Net 8!
Sen-Gupta commentedon Feb 4, 2024
Workaround:
Add following to your MAUI Project file, until the issue is fixed.
james-world commentedon Feb 14, 2024
It's not enough to do this if you actually want CPM in your projects; you need the undocumented
DisableImplicitLibraryPacksFolderproperty added to your Directory.Packages.props (or other project file). This is mentioned in #28642.Personally, I've never used MAUI - think I may have inadvertently installed it on my Mac as part of Visual Studio for Mac (now uninstalled since it's been discontinued) but it's left detritus on my machine I'm not sure how to clean properly. This fixed it for me:
epsmae commentedon Mar 8, 2024
The workaround mentioned by @james-world works for me, below you see the snippets.
I can use central package management like that in the referenced non maui and the test projects.
Not what I desired but hopefully this gets soon fixed.
Directory.Packages.props
Maui Project
epsmae commentedon Dec 19, 2024
Are there any news regarding that in .Net 9?
Is it planned that maui will support Directory.Packages.props in the future?
fabEps commentedon Apr 4, 2025
Fixed by dotnet/maui#17235 ?
aelij commentedon Oct 30, 2025
@fabEps Sounds like it. Closing.