Could not load type 'Microsoft.SharePoint.Administration.DesignPackageType'

Submitted by Vladilen on Sun, 11/03/2019 - 20:10

Recently I tried to update module "Microsoft.Online.SharePoint.PowerShell". It was updated OK, but:

Get-Module Microsoft.Online.SharePoint.PowerShell -ListAvailable | ft -a

gave me two modules So I tried to uninstall module with older version "16.0.8525.1200" and import module with newer version. It failed with error: "The version '###' of module '16.0.8525.1200' is currently in use. Retry the operation after closing the applications.

Solution for "version is currently in use": just close powershell window, open it again and do Uninstall

Then I found at Microsoft: "If you already have a previous version of the shell installed, uninstall it first and then install the latest version." Ok, I uninstalled all modules, then installed new one again: 

Find-Module Microsoft.Online.SharePoint.PowerShell | ft -a
Install-Module Microsoft.Online.SharePoint.PowerShell
Get-Module Microsoft.Online.SharePoint.PowerShell -ListAvailable | ft -a

But when I tried to 

Import-Module Microsoft.Online.SharePoint.PowerShell

I got: "Could not load type 'Microsoft.SharePoint.Administration.DesignPackageType' from assembly 'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=...'..

Import-Module : Could not load type 'Microsoft.SharePoint.Administration.DesignPackageType' from assembly 'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken='

Solution for "Could not load type...":

- close PowerShell windows
- go to C:\Windows\Microsoft.NET\assembly\GAC_MSIL
- remove all Microsoft.SharePoint.Client* folders
- start PowerShell, uninstall module and install it again

 

Credit goes to Glenn Goffin

https://techcommunity.microsoft.com/t5/Office-365/Can-t-import-SharePoint-online-Powershell-module/m-p/871594/highlight/true#M24658