Open aelij opened 1 year ago
May be a duplicate of https://github.com/NuGet/Home/issues/11951.
@jeffkl any thoughts on this? If related to https://github.com/NuGet/Home/issues/11951, when are we likely to see this fix being widely available?
@nickrandolph the change shipped with Visual Studio 2022 17.4 and .NET SDK 6.0.4xx
This issue is still reproducible with .NET SDK 6.0.402, which includes NuGet 6.3.1-rc.1+01bc4df1ef99c9c213f892ec8b25e46b23c7cfb1.01bc4df1ef99c9c213f892ec8b25e46b23c7cfb1 (see https://github.com/NuGet/Home/issues/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 https://github.com/NuGet/NuGet.Client/pull/4764. @jeffkl, did you mean some other change?
@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.
The issue is again raised in dotnet 8.0. Works fine with dotnet 7.0.
Issue occurs in .Net 8!
Workaround:
Add following to your MAUI Project file, until the issue is fixed.
<PropertyGroup>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>
Workaround:
Add following to your MAUI Project file, until the issue is fixed.
<PropertyGroup> <ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally> </PropertyGroup>
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 https://github.com/dotnet/sdk/issues/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:
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<DisableImplicitLibraryPacksFolder>true</DisableImplicitLibraryPacksFolder>
</PropertyGroup>
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
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<!-- See Maui Issue: https://github.com/dotnet/sdk/issues/27840 -->
<DisableImplicitLibraryPacksFolder>true</DisableImplicitLibraryPacksFolder>
</PropertyGroup>
<!-- Microsoft Package Versions -->
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
...
</ItemGroup>
...
</Project>
Maui Project
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('android')) And !$([MSBuild]::IsOSPlatform('ios'))">$(TargetFrameworks);net8.0</TargetFrameworks>
<!-- See Maui Issue: https://github.com/dotnet/sdk/issues/27840 -->
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />
</ItemGroup>
...
</Project>
Describe the bug
When using NuGet Central Package Management and MAUI installed, we get the following error:
To Reproduce
Directory.Packages.props
file with<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
dotnet restore
Workaround
Further technical details