dotnet add package silently fails if CPM enabled and implicit SDK references exist to package #13809
Labels
Area:RestoreCPM
Central package management
Functionality:Restore
Priority:3
Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.
Type:Bug
NuGet Product Used
dotnet.exe
Product Version
9.0.100-rc.1.24452.12
Worked before?
No response
Impact
It's more difficult to complete my work
Repro Steps & Context
Repro
dotnet new globaljson --force --sdk-version 9.0 --roll-forward latestFeature
dotnet new mstest --framework net9.0
Directory.Packages.props
withManagePackageVersionsCentrally=true
andCentralPackageTransitivePinningEnabled=true
dotnet add package Microsoft.NET.Test.Sdk --version 17.11.1
Interestingly an empty
<ItemGroup />
is added to csproj, which is an indication it tries to do something but fails half-way.If I manually add the package reference
I'll get a warning
which likely part of the root cause as
Microsoft.NET.Test.Sdk 17.10.0.
is part of theMSTest.Sdk
and in .NET 9 SDK MSTest template CSPROJ there're not longer any package referencesbut they're part of the SDK targets
https://github.com/microsoft/testfx/blob/db0db46bc8ef5f99af7048156b2685877da89c80/src/Package/MSTest.Sdk/Sdk/Runner/ClassicEngine.targets#L40-L41
Current workaround is to set
MicrosoftNETTestSdkVersion
manually toDirectory.Packages.props
so it looks something like thisand
csproj
While this kinda works, it's a bit of a hack and it breaks some CI and SBOM tools.
Verbose Logs
The text was updated successfully, but these errors were encountered: