I doubt it has anything to do with the versions of Windows or the .NET assemblies, since I’ve been able to successfully deploy to a number of these servers last week.
But anyhow: this is Windows Server 2008 R2 Standard 64 bit. See the attached screenshot for the versions of the frameworks installed.
BTW, the difference with the servers on which the deployment does work, is that they have the System.Web.Extensions, Version=3.5.0.0 installed in the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5 folder. I don’t know with what software that got installed, but there is not .NET Framework 3.5 installed explicitly.
Anyhow: on the servers that don’t have this package installed in this folder, Octopus deployments worked before, so it seems strange that this needs to be a prerequisite now…
I think the issue is the incompatibility between CLR and .NET version on those Tentacles. You are running CLR 2.0 with .NET 4.5.2 which are incompatible. You have (somehow) .NET 3.5 on the Tentacles that work. See here for .NET framework CLR versions: https://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx
I think the solution would be to install .NET 3.5.1 or update the PowerShell version on the Tentacle. It does seem odd that the deployments were working before and is certainly frustrating when they suddenly stop working.
I see what you mean. The $PSVersion says it’s using CLRVersion 2.0.50727.5485. But then I’m wondering: how does the correct CLRVersion get used “out of the box”? Your tentacle requirements state that I need .NET 4.5+ and Powershell 2.0, which (as you state) “is automatically installed on 2008 R2”. That is exactly what we have, but still it does not work. Is there something you need to add to this requirement then?
This config file needs to be added as wsmprovhost.exe.config to C:\Windows\SysWOW64 and C:\Windows\system32 and as powershell.exe.config to C:\Windows\system32\WindowsPowerShell\v1.0 and C:\Windows\SysWOW64\WindowsPowerShell\v1.0.
This forces Powershell to use the CLRVersion 4 and then it works!
But still, I’m curious how I could have gotten this to work with your base requirements of having .NET 4.5+ and out-of-the-box Powershell 2.0 on 2008R2.
You are correct, we need to re-think our requirements. Either we need to bump the PowerShell version or explicitly check .NET versions when running on CLR 2.
I’m glad you found a way to set the PowerShell CLR version and it is working for you. Although I can’t find much documentation around wsmprovhost.exe.config one of my colleagues has a few scars and recalls explicitly setting the PowerShell CLR version also affecting other applications. That’s something you may need to be wary of.
Glad to hear you are back deploying and we will review our requirements.
Thanks for the clarification. I guess that the most fail-safe way forward for us is then to upgrade to Powershell 4 anyway. I guess we’ll take that route.
You could try installing .NET 3.5.1 or upgrading to PowerShell 4. This error can be caused by an incompatibility between your .NET and PowerShell versions.