I am working on an extension for visual studio to update a project.
The situation is a follows:- We create a new project from a template.
- We put the solution in tfs
- We change the project which was used to create the template. The project on the tfs server still needs te be updated.
- We publ开发者_开发问答ish the project to a folder. I now want to update the files in the TFS repo with the current files in the publish folder
I thought of the following approach:
In the application we have all the project stored that are on the TFS server. When I want to update a specific project I select the project from the database. Next I load this project from the TFS server and create a new checkout for this project. So far so good. The problem arise when I copy the files from the published folder to the new checkout. Files that are already registered in the workspace get marked as changed but the files that are new are not added.The only solution I can think of is to add all the files through the TFS SDK. But this seems pretty heavy to me.
So I got a couple of questions:
- Is this the right approach to update the project?
- Is there any other way to add the files to the workspace instead of adding all files through the TFS SDK?
Thanks!
Don't do a blind copy of the files. Instead, have your program iterate through them one by one.
- First, update your workspace with the latest from TFS.
- Then, for each file in the source directory:
- If the file exists in the target directory, "pend edit" the file, then copy it.
- If the file does not exist, copy the file, then "pend add" the file.
- When you've finished, check in all pending changes in the workspace.
精彩评论