Skip to content

"dotnet package update" failed to update package Microsoft.Testing.Extensions.CodeCoverage #14712

@CyberSinh

Description

@CyberSinh

NuGet Product Used

dotnet.exe

Product Version

dotnet.exe 10.0.101

Worked before?

No response

Impact

It's more difficult to complete my work

Repro Steps & Context

I'm trying to use the .NET 10 CLI to automatically update outdated nuget packages of my C# projects.
But the command dotnet package update failed on every MSTest.Sdk projet:

<Project Sdk="MSTest.Sdk/4.0.2">
  (...)
  <ItemGroup>
    <PackageReference Update="Microsoft.Testing.Extensions.CodeCoverage" Version="18.3.1" />
  </ItemGroup>
</Project>

I get the following error message:

Updating Microsoft.Testing.Extensions.CodeCoverage 18.1.0 to 18.3.2.  
Unhandled exception: Erreur d'exécution de Update pour le package 'Microsoft.Testing.Extensions.CodeCoverage'.
Impossible de modifier les éléments dans les fichiers importés -  
Elément 'PackageReference' pour 'Microsoft.Testing.Extensions.CodeCoverage' dans le fichier importé 'C:\Users\sylva\.nuget\packages\mstest.sdk\4.0.2\Sdk\Runner\ClassicEngine.targets'. 
System.Management.Automation.RemoteException

It seems that the command only works for Nuget packages defined with Include but not those defined with Update.

However, updating Update packages works without any difficulty with Visual Studio.

Is there a way to update them from the command line without going through Visual Studio?
Why can't the dotnet package update command natively handle this type of update?

Thanks.

Verbose Logs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions