【发布时间】:2020-01-07 03:12:57
【问题描述】:
在 VScode 中运行此命令不起作用,但在 PowerShellPlus 中有效。
Connect-PnPOnline -Url "https://something.sharepoint.com/" -Credentials $userCredential
错误:
System.MissingMethodException: Method not found: 'System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String, System.String)'.
at SharePointPnP.PowerShell.Commands.Base.ConnectOnline.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
我已尝试卸载 VScode 并删除我机器上的任何 SharePoint 痕迹,但我无法克服此错误。有什么想法吗?
编辑: 在这篇博文之后,我删除并重新安装了 SP PNP 模块。 https://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=802
- 从控制面板中删除所有 SharePoint 组件 (添加/删除)
- 打开 GAC 位置 (C:\windows\Microsoft.NET\assembly\GAC_MSIL),搜索词条 SharePoint 并删除所有文件夹。 (这是必需的,因为 PnP 命令使用的参考仍然很旧)
- 重新启动机器
- 安装最新版本的 SharePoint PnP
【问题讨论】:
-
当您明确尝试使用 Sharepoint 组件时,为什么要从您的计算机中删除它们?那不会在这里解决您的问题。您必须确保已导入您计划在 VSCode 配置文件中使用的任何模块。 --- Microsoft.VSCode_profile.ps1 --- PSPlus 正在使用默认的 PowerShell 配置文件,您必须在此处为 SharePoint 提供 Imports 才能在 PSPlus 中工作。它也需要与您的 PowerShell 配置文件位于同一位置。
-
@postanote 我删除并重新安装了 SP PNP 模块。更新我的帖子以提供更多上下文。
标签: powershell sharepoint visual-studio-code