I modified the custom build process template to run Powershell on the build server. This means that I can run some scripts that will automate the deployment of our SharePoint solution. Everything worked fine until I upgraded Powershell servers from version 2.0 to 3.0 (which was necessary when I installed the SCVMM 2012 console console and Powershell 3.0 was a prerequisite).
In the assembly template itself, I use the Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess workflow element to execute a PowerShell command with the following properties:
Arguments: String.Format ("" & '{0}' -DropLocation '{1}' {2} "" ", ScriptFilename, BuildDetail.DropLocation, PostDropScript2Arguments)
Filename: "powershell"
OutputEncoding: System.Text.Encoding.GetEncoding (System.Globalization.CultureInfo.InstalledUICulture.TextInfo.OEMCodePage)
Now every time I try to build, I get the following error:
Exception message: File not found: PowerShell (type FileNotFoundException) Trace exception stack: server stack trace:
at Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess.ProcessWrapper.Start () at Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess.InvokeProcessInternal.RunCommand (AsyncState state) in System.Runtime.ProcessMermindPreport.Mentemre (IntPtr md, Object [] args, Object server, Object [] & outArgs) in System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage (Shezade msg, IMessageSink replySink)
Exception thrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper (Message reqMsg, Boolean bProxyCase) with System.Runtime.Remoting.Proxies.RemotingProxy.Invoke (Object NotUsed, MessageData & ms. Func 2.EndInvoke(IAsyncResult result) at System.Activities.AsyncCodeActivity 1.System.Activities.IAsyncCodeActivity.FinishExecution (AsyncCodeActivityContext context, result IAsyncResult) in System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute (ActivityExecutor performer, BookmarkManager bookmarkManager)
Internal exception information:
Exception message: the system cannot find the specified file (type Win32Exception) Exceptional stack trace: when System.Diagnostics.Process.StartWithCreateProcess (ProcessStartInfo startInfo) in Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess.ProcessWrapper.Start ()
It seems that the assembly can no longer link the powershell command to the actual PowerShell file.
I manually went to the build server and typed "powershell" at the command prompt, and it launched PowerShell, as expected.
Has anyone else experienced this problem before?
Thank you very much