Hi I'm trying to make a simple application that builds and deploys my solution through a web page. My approach has been to make a nant script that runs tf.exe a number of times and to run this nant script from the web page (this might seem strange, but it was chosen simplify maintenance). The Web page runs in a separate application pool (Windows 2003) having the identity of the user I'm using all automated tasks from.
The application works fine up until I'm running the "tf get c:\deploy /recurive" where it complains about "Unable to determine the workspace". Before this line I have run several tf commands on the server, successfully, but none of them requires workspace.
I have checked: - that the user is correct by prompting the user name to screen - that the working folder is correct - that the same syntax and user runs fine from command line.
What is needed on the local machine besides user name and folder to determine the workspace? Is there something in the registry or system variables that haven't been loaded correctly?
Any suggestions will be greatly appreciated.
Snorre
|
| piip |
The line is of course tf get c:\deploy /recursive
|
| piip |
I've reduced the problem to this code run in the web application pool of a user that has a workspace in c:\project\build: string command = @"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\tf.exe"; string args = "get"; ProcessStartInfo f = new ProcessStartInfo(command); f.Arguments = args; f.UseShellExecute = false; f.RedirectStandardError = true; f.RedirectStandardOutput = true; f.RedirectStandardInput = true; f.CreateNoWindow = true; f.WorkingDirectory = @"c:\project\build"; f.LoadUserProfile = true; f.WindowStyle = ProcessWindowStyle.Normal;
Still getting "unable to determine workspace"
Shouldn't this work?
|
| piip |
| Have you considered using the Version Control API rather than shelling out to tf.exe? That would be much more reliable. |
| William Bartholomew |
I could of course do that, but we have a large nant scripts used for deployment and that would mean that I have to maintain two sources. I don't really (really) need the web page, but it's my curiosity as to why tf.exe doesn't find the workspace through iis that is driving me now. Running the deployments manually is less work than maintaining two different deployment sources.
|
| piip |
| Try changing f.WorkingDirectory to c:\deploy. |
| Richard Berg MSFT |
Thanks, but didn't help.
What puzzles me is that "workspaces" and "workspace" command works perfectly. Identifies the user correctly and everything. My theory is that the "get" command doesn't find the server, perhaps because the registry isn't loaded completely in the application pool. I find it strange that the "get" command doesn't accept the /server tag. Anybody know why?
|
| piip |
If the problem only happens with Get, it's probably due to threading -- Get does its downloading on a background thread, and those threads don't always inherit the app pool credentials correctly. See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=771972&SiteID=1
|
| Richard Berg MSFT |
Excellent, thank you. Updating the processmodel in machine.config did the trick. in retrospect the threading problem is quite obvious, since when creating the workspace and working folders in the same method/thread made the get command work, but using an existing workspace did not.
Thanks again.
|
| piip |