Repository navigation
[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
Description
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.
- Open command prompt window.
- 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
baronfel commentedon Jul 15, 2025
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.
marcpopMSFT commentedon Jul 25, 2025
SDK change merged, now we need dotnet/dotnet flow and a new build.
CancanTang commentedon Aug 1, 2025
Verified with dotnet-sdk-10.0.100-preview.7.25380.108, it has been fixed.
Junjun-zhao commentedon Aug 4, 2025
@baronfel @marcpopMSFT Could you please close this issue, as it has already been resolved? Thanks.
SDK to 10.0.100-preview.7.25380.108 because of dotnet/sdk#49786