在TFS中导入Sharepoint模块Powershell构建脚本

问题描述:

我试图在TFS中将版本运行到Sharepoint Online,我似乎无法导入和加载模块。在TFS中导入Sharepoint模块Powershell构建脚本

我尝试了直导入模块声明:

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking 

我找到这个解决方案,但是,这不是玩球无论是。

How to load PowerShell Module from custom script on vNext build agent?

您必须加载该程序集,然后才能使用它里面的类型。

可以使用的loadFile方法,

[Reflection.Assembly]::LoadFile(“c:\folderwhereyouhavesharepointassemblies/thedllname.dll”) 

Import-Module Microsoft.Online.SharePoint.PowerShell