问题
I'm using web deploy to a remote server, through which we can only connect through a Cisco VPN client.
In my TFS project file I have an EXEC task to open the client, then one to close it.
<Exec Command="start $(COMSPEC) /C "C:\Program Files (x86)\Cisco Systems\VPN Client\vpnclient.exe" connect profile user me pwd password" ContinueOnError="false" />
Without these EXEC tasks and if I open the connection manually then the deployment works. But these commands aren't opening the client in the build, it just hangs on this task before opening the client.
If I copy this task and paste into a standard build file and call that from msbuild.exe then the client is opened.
Do you know why it won't work in the TFS project when the build is called but it would work manually in a separate build file?
回答1:
For kicks I would try using the full path to comspec: "C:\Windows\system32\cmd.exe" or whatever path for the OS you are using in the off-chance it is resolving incorrectly.
Also, can you toss in a /k to keep the cmd prompt open and see what, if any, errors show assuming it launches correctly?
回答2:
I couldn't work this one out. So I used Invoke Process in the XAML template instead. Which has worked fine.
来源:https://stackoverflow.com/questions/6470242/exec-task-in-msbuild-tfs-wont-execute-exe-properly