3

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.

4
  • 2
    What does the Process tab of the build process template look like? Did you specify the source control path to the script? Commented Apr 3, 2015 at 19:57
  • And if you've mapped the source control path correctly, have you included this in your source mappings to make sure the file is downloaded to your build server? Commented Apr 5, 2015 at 5:49
  • Thanks for the response @DanielMann. In the ProcessTab I have under the default template (TfvcTemplate.12.xaml) 2 Build -> 5.Advanced -> Post Build Script Arguments: -verbose Post Build Script Path: $/TeamProject/Dev/Solution/DeploymentScripts/PostBuildDeployment.ps1 In the Source Settings Tab: Source control: $/TeamProject/Dev/Solution/DeploymentScripts/PostBuildDeployment.ps1 Build Agent: C:\Projects\Dev\Solution\DeploymentScripts/PostBuildDeployment.ps1 Source control: $/TeamProject/Dev/Solution Build Agent: C:\Projects\Dev\Solution Commented Apr 6, 2015 at 14:42
  • @WouterKort refer to my previous comment for the source mapping, I have seen this downloaded to the build directory. Commented Apr 6, 2015 at 14:43

1 Answer 1

2

(Coming from someone who recently encountered this issue themselves)

Check your "Source Settings" in the build definition.

  • Make sure you haven't cloaked the path to your script. That is, if you have your script in utilities/configuration, make sure you haven't cloaked utilities/
  • Your Build Agent folder should not use $(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.

Sign up to request clarification or add additional context in comments.

1 Comment

Fixed my problem too !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.