Skip to content

[dotnet-sdk-10.0.100-preview.7.25362.103] dotnet tool install command get error: System.TypeLoadException: Could not load type 'System.CommandLine.CommandLineConfiguration' from assembly 'System.CommandLine'. #49786

Closed

Description

@Junjun-zhao

Description

When installing dotnet tools with "dotnet tool install" command, it gets error:

Unhandled exception. System.TypeLoadException: Could not load type 'System.CommandLine.CommandLineConfiguration' from assembly 'System.CommandLine, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 

Unhandled exception: Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageInstallerException: Failed to validate package signing.

Reproduction Steps

The machine only has dotnet-sdk-10.0.100-preview.7.25362.103 installed and environment variable DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX set as 2.

  1. Open command prompt window.
  2. Execute command: "dotnet tool install -g coverlet.console".

Expected behavior

Tool successfully installed.

Actual behavior

Tool installation failed with error:

Unhandled exception. System.TypeLoadException: Could not load type 'System.CommandLine.CommandLineConfiguration' from assembly 'System.CommandLine, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

   at NuGet.CommandLine.XPlat.Program.MainInternal(String[] args, CommandOutputLogger log, IEnvironmentVariableReader environmentVariableReader)
   at NuGet.CommandLine.XPlat.Program.MainInternal(String[] args, CommandOutputLogger log, IEnvironmentVariableReader environmentVariableReader)
   at NuGet.CommandLine.XPlat.Program.Main(String[] args)
Unhandled exception: Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageInstallerException: Failed to validate package signing.
   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.VerifySigning(String nupkgPath, SourceRepository repository)
   at Microsoft.DotNet.Cli.NuGetPackageDownloader.NuGetPackageDownloader.DownloadPackageAsync(PackageId packageId, NuGetVersion packageVersion, PackageSourceLocation packageSourceLocation, Boolean includePreview, Nullable`1 includeUnlisted, Nullable`1 downloadFolder, PackageSourceMapping packageSourceMapping)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloader.<>c__DisplayClass2_0.<DownloadAndExtractPackage>b__0()
   at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloaderBase.DownloadTool(DirectoryPath packageDownloadDir, PackageId packageId, NuGetVersion packageVersion, INuGetPackageDownloader nugetPackageDownloader, PackageSourceLocation packageSourceLocation, Boolean givenSpecificVersion, DirectoryPath assetFileDirectory, String targetFramework, VerbosityOptions verbosity)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloaderBase.<>c__DisplayClass14_0.<InstallGlobalToolPackageInternal>b__0()
   at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloaderBase.InstallGlobalToolPackageInternal(PackageSourceLocation packageSourceLocation, INuGetPackageDownloader nugetPackageDownloader, PackageId packageId, NuGetVersion packageVersion, Boolean givenSpecificVersion, String targetFramework, Boolean isGlobalToolRollForward, VerbosityOptions verbosity)
   at Microsoft.DotNet.Cli.ToolPackage.ToolPackageDownloaderBase.InstallPackage(PackageLocation packageLocation, PackageId packageId, VerbosityOptions verbosity, VersionRange versionRange, String targetFramework, Boolean isGlobalTool, Boolean isGlobalToolRollForward, Boolean verifySignatures, RestoreActionConfig restoreActionConfig)
   at Microsoft.DotNet.Cli.Commands.Tool.Install.ToolInstallGlobalOrToolPathCommand.<>c__DisplayClass25_0.<ExecuteInstallCommand>b__2()
   at Microsoft.DotNet.Cli.Commands.Tool.Install.ToolInstallGlobalOrToolPathCommand.RunWithHandlingInstallError(Action installAction, PackageId packageId)
   at Microsoft.DotNet.Cli.TransactionalAction.<>c__DisplayClass5_0.<Run>b__0()
   at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
   at Microsoft.DotNet.Cli.TransactionalAction.Run(Action action, Action commit, Action rollback)
   at Microsoft.DotNet.Cli.Commands.Tool.Install.ToolInstallGlobalOrToolPathCommand.ExecuteInstallCommand(PackageId packageId)
   at Microsoft.DotNet.Cli.Commands.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
   at Microsoft.DotNet.Cli.Commands.Tool.Install.ToolInstallCommand.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)

Regression?

Yes

Windows10 21h2 x64 + dotnet-sdk- 8.0.400: Pass
Windows10 21h2 x64 + dotnet-sdk-10.0.100-preview.7.25358.102: Pass
Windows10 21h2 x64 + dotnet-sdk-10.0.100-preview.7.25362.103: Fail

Known Workarounds

No response

Configuration

Application Name: GlobalToolsNETCore21Part02, GlobalToolsNETCore22, GlobalToolsNETCore21Part01, Globaltools
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-10.0.100-preview.7.25362.103

Other information

Findings:

It looks like this issue is caused by CommandLineConfiguration was removed in this pull request: Separate parse from invocation configurations by jonsequitur · Pull Request dotnet/runtime#2606 · dotnet/command-line-api and there is a similar issue: #49765 reported.

@dotnet-actwx-bot @dotnet/compat

Activity

  1. baronfel commented on Jul 15, 2025

    @baronfel
    Member

    This, and all other Nuget-presenting System.CommandLine mismatch errors that have been reported on preview 7 builds, will be fixed by #49740, which itself requires NuGet/NuGet.Client#6554.

  2. marcpopMSFT commented on Jul 25, 2025

    @marcpopMSFT
    Member

    SDK change merged, now we need dotnet/dotnet flow and a new build.

  3. CancanTang commented on Aug 1, 2025

    @CancanTang

    Verified with dotnet-sdk-10.0.100-preview.7.25380.108, it has been fixed.

  4. Junjun-zhao commented on Aug 4, 2025

    @Junjun-zhao
    MemberAuthor

    @baronfel @marcpopMSFT Could you please close this issue, as it has already been resolved? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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