I can load System.Windows.Forms using below line :
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
$openFile = New-Object System.Windows.Forms.OpenFileDialog
But not able to load SharePoint assemblies using the similar line script:
[reflection.assembly]::loadwithpartialname("Microsoft.SharePoint.Publishing") | Out-Null
$obj = New-Object Microsoft.SharePoint.Publishing.Design
Getting below error:
New-Object : Cannot find type [Microsoft.SharePoint.Publishing.Design]: verify that the assembly containing this type is loaded`.
Am I doing any mistake. Same with Add-Type.