This project is read-only.

SPSD on Sharepoint 2010 cant run because of framework 4?

Jul 18, 2013 at 2:06 PM
I downloaded the Sharepoint Solution deployer SPSD, and I want to use it an SPSD 2010 Farm, to install jusst a wsp


But I got this error, which is pretty obvious, 2010 projects run on 3.5 framework instead of 4, but I have no idea what should I change?
Get-SPServer : Microsoft SharePoint is not supported with version
4.0.30319.1008 of the Microsoft .Net Runtime.
At C:\dev\username\slice\xx\xx\SolutionInstalle
\R2\Scripts\SPSD_Base.ps1:64 char:30
+            $Script:servers = Get-SPServer | Where-Object {$_.Role -ine
"Invalid" ...
+                              ~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...CmdletGetServer:
   SPCmdletGetServer) [Get-SPServer], PlatformNotSupportedException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetServe
   r
Jul 21, 2013 at 7:59 AM
Edited Jul 21, 2013 at 8:03 AM
I tested SPSD on the following configuration
  • Windows Server 2008 R2,
  • SharePoint 2010,
  • Visual Studio 2012 (which brings the .net 4.5 framework on the machine)
When executing SPSD everything runs as expected without the described error.

What does it show when you open a ordinary PowerShell prompt and run
[System.Reflection.Assembly]::GetExecutingAssembly().ImageRuntimeVersion
On the above configuration it shows for me
v2.0.50727

On a SharePoint 2013 server (with Windows Server 2012 as OS) it shows
v4.0.30319

In both cases executing
asnp Microsoft.SharePoint.PowerShell
Get-SPServer
runs perfectly.

Can it be that you installed SharePoint 2010 on a Server 2012 (which is not supported unless you have SP2010 SP2 installed)?
If you have a look here http://support.microsoft.com/kb/2724471 you see in issue 3 exactly the same error message you described.
Jul 21, 2013 at 8:06 AM
Oh, forgot to add, the above issue also occurs when you install Windows Management Framework 3.0 on a Server 2008 R2 which brings PowerShell 3.0 with it.
This is also not supported by SharePoint 2010 so far.

You shouldn't be able to run any SharePoint related PowerShell command in the PowerShell console in that case. So SPSD is only behaving exactly like the rest of the console.
Jul 23, 2013 at 12:22 PM
I have found one way around it :)

In the batch files Deploy.bat, Retract.bat etc
PowerShell is executed at the very end

as and example here the command from Deploy.bat
"%SYSTEMROOT%\system32\windowspowershell\v1.0\powershell.exe" -Command Start-Process "$PSHOME\powershell.exe" -Verb RunAs -ArgumentList "'%~dp0\Scripts\SPSD_Main.ps1 -Command %command% -Type %type% -Verbosity %verbosity% %saveEnvXml%'"
if you add the parameter
-Version 2
so that it looks like
"%SYSTEMROOT%\system32\windowspowershell\v1.0\powershell.exe" -Command Start-Process "$PSHOME\powershell.exe" -Verb RunAs -ArgumentList '-Version 2  ".\Scripts\SPSD_Main.ps1 -Command %command% -Type %type% -Verbosity %verbosity% %saveEnvXml%"'
That should launch PS in .net 2 instead of .net 4

The important parts are
  1. The parameter -Version 2in the ArgumentList
  2. I had to switch the ' and the " on the script parameter in order to make it work
  3. I replaced %~dp0 with .\ (which is a known issue causing problems when having spaces in the path where SPSD is run from)
Let me know if it works then!
Jul 23, 2013 at 12:26 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 23, 2013 at 12:27 PM
BTW, unfortunately this can't be added permanently into SPSD because with the "-version 2" parameter SPSD will then fail on SP2013 systems.
Jul 23, 2013 at 12:48 PM
Great one - working like a charm!

I would propose a solution for the 2010 environment + VS2012/VS2013. Check the version of the installed SharePoint like you do for the powershell version.
If 14 pass version 2, if 15 pass version 3.

Thanks again!
Max
Jul 29, 2013 at 11:25 AM
I think the version switch will be more important once they release the new PowerShell version (announced today). Maybe SP2013 is not PowerShell v4 compatible.
When I find the time I will contribute it.

Cheers!
Max
Sep 13, 2013 at 7:52 AM
This issue is solved now in the lates release.