can not import Teams PowerShell module in .net core 3.1

New Contributor

I tried to import the teams powershell module in .net core 3.1, windows server 2012r2, and the Microsoft.PowerShell.SDK version is 7.0.8. I can get the module via Test-ModuleManifest, but the teams module can't be imported, there is no any errors, I have tried some different teams PS gallery version like 2.3.1, 2.6.0. I can import the teams module in powershell desktop in the same windows environment. 


PSModuleInfo teamsModule = null;
using (Pipeline pipeLine = runspace.CreatePipeline())
Command command = new Command("Test-ModuleManifest");
//command.Parameters.Add("Path", @"C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.6.0\MicrosoftTeams.psd1");
command.Parameters.Add("Path", @"C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\MicrosoftTeams.psd1");
//command.Parameters.Add("Path", path);
System.Collections.ObjectModel.Collection<PSObject> psResult = pipeLine.Invoke();
teamsModule = psResult[0].BaseObject as PSModuleInfo;
using (Pipeline pipeLine1 = runspace.CreatePipeline())
Command command = new Command("Import-Module");
command.Parameters.Add("ModuleInfo", teamsModule);
command.Parameters.Add("PassThru", true);
System.Collections.ObjectModel.Collection<PSObject> psResult1 = pipeLine1.Invoke();




7 Replies


Please refer below doc and check if it helps you in any way.





If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate. 

Thanks for you response. From the link you provided, it seems that I need to install the PowerShell 6.0 or above, In my windows server, I have both installed the PowerShell 5.1 and PowerShell 7.1.5, and I used VS 2019, .net core 3.1 to try to import the teams module, I can import the teams module in PowerShell 5.1 desktop and PowerShell 7.1.5 desktop, but when I used the same script to import the teams module in VS 2019, it can't be imported. I can get the moduleinfo from Test-ModuleManifest, but when I used the moduleinfo to import, there is nothing. can you help to provide some suggestions?


We are checking on this , we will get back to you once we get any update.


Could you please check below document.In document its already mention that for installing microsoft teams module use .NET Framework 4.7.2 or later.
Install Microsoft Teams PowerShell - Microsoft Teams | Microsoft Docs

I have checked my environment, I have installed the .NET Framework 4.7.2. and because I used .net core 3.1 in my project ,so this issue shouldn't be related to .NET Framework version.
it is the information below in my environment:
Windows: Windows Server 2012 R2 Datacenter
.NET Framework: 4.7.2
PowerShell: 5.1 and 7.0.8
.NET Core: 3.1.101 and 5.0.402
VS(Project used): Microsoft Visual Studio Enterprise 2019 Version 16.11.5
Microsoft.PowerShell.SDK(Project used): 7.0.8
.NET Core(Project used): netcoreapp3.1


Looking forward to your reply

@hua ,Is your issue resolved or are you still facing any problem?