I have a TFS Build definition using the default template. The build completes on it's own but when I include a post deployment script I get the following error.
Exception Message: The directory name is invalid (type Win32Exception)
Exception Stack Trace:
Server stack trace:
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess.ProcessWrapper. Start()
at Microsoft.TeamFoundation.Build.Workflow.Activities.InvokeProcess.InvokeProcessIn ternal.RunCommand(AsyncState state)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at System.Func`2.EndInvoke(IAsyncResult result)
at System.Activities.AsyncCodeActivity`1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncC odeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
The script itself is a powershell script that is included in the solution I'm trying to build and it only calls write-host messages. (for testing at this point)
The build definition has all the defaults selected with only the solution, post build arguments and post build script path changed. The script is checked into source control in the solution.
This is a POC environment so I have everything installed on the one server, so the TFS Server and Build Agents are on the same machine.
I've tried several workaround for this but none of them seem to be rooted around this particular error. Any help is much appreciated, thanks.
(Coming from someone who recently encountered this issue themselves)
Check your "Source Settings" in the build definition.
utilities/configuration, make sure you haven't cloaked utilities/$(BuildDir), it should use $(SourceDir). Bear in mind this might change some paths in your script. There is apparently a bug in the latest version of TFS that causes this hair-pulling issue. All the stuff about setting %WINDIR% in your Start-in directory for Powershell/Cmd etc. didn't work, but this did.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With