每当我在新的 VS 2017 会话中打开包管理器控制台时,它都会显示以下两条错误消息,并且所有意图和目的都可以正常运行。至少对于像Install-Package
.
Join-Path : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ChildPath'. Specified method is not supported.
At C:\Dev\.NET\Projects\AcmeSoft\Code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\init.ps1:13 char:57
+ ... rPackageDirectory = Join-Path $packageDirectory $compilerPackage.Name
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Join-Path], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.JoinPathCommand
和
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Dev\.NET\Projects\AcmeSoft\Code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\init.ps1:14 char:44
+ ... erPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
第一个违规行是:
$compilerPackageDirectory = Join-Path $packageDirectory $compilerPackage.Name
错误在$compilerPackage.Name
(即“char:57”)
第二个违规行是:
$compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools'
错误为$compilerPackageDirectory 'tools'
。
任何比我拥有更多 Nuget 和/或 PowerShell 技能的人都可以解释为什么会发生这种情况,以及我该如何解决它,好吗?