我已经安装了PowerShell 6.1.3,我尝试运行一些命令,例如:
Get-PackageProvider
或
GetPackage
然后我得到以下错误:
get -packageProvider:未经处理的异常 - 消息:''microsoft.packagemanagement.internal.utility.plugin.dynamictype'扔了一个例外。'名称:" typeInitialization exception'堆栈跟踪:' 在microsoft.packagemanagement.internal.utility.plugin.dynamictype.create(键入tinterface,ordereDdictionary`2 InstanceMethods,list`2s`2 delegatemethods,list'1 upmethods,list`2 usedinstances) 在Microsoft.packagemanagement.internal.utility.plugin.dynamicinterface.createproxy(键入tinterface,object []实例) 在Microsoft.packagemanagement.internal.utility.plugin.dynamicinterface.dynamiccast(键入tinterface,object []实例) 在Microsoft.packagemanagement.internal.utility.plugin.dynamicinterface.dynamiccast [tinterface](object []实例) 在microsoft.packagemanagement.internal.utility.plugin.dynamicinterfaceextensions.as [tinterface](object Instance) 在microsoft.powershell.packagemanagement.cmdlets.cmdletbase.get_packagemanagementhost() 在Microsoft.powershell.packagemanagement.cmdlets.cmdletbase.selectproviders(字符串[]名称) 在microsoft.powershell.packagemanagement.cmdlets.getpackageprovider.processrecordasync()() 在Microsoft.powershell.packagemanagement.cmdlets.asynccmdlet。在线:1 char:1 get-packageProvider ~~~~~~~~~~~~~~~~~~ categoryInfo:无效媒介:( Microsoft.power ... PackageProvider:GetPackageProvider)[Get-PackageProvider],异常 完全qualifiedErrid:unhandledException,microsoft.powershell.packagemanagement.cmdlets.getpackageprovider
如何解决此问题?
我也面临着类似的问题,运行Nuget相关命令抛出了异常。但是,然后我在管理模式下运行了类似的命令。我可以解决这个问题。