How can I create a TFS 2010 Team Project using the SDK?
I've heard that it's not possible, but I figured I'd ask here and get a definitive answer. Is there a way to use the Team Foundation Server 2010 SDK to programatically create a new project in a collection?
So far, all I've 开发者_高级运维seen is to use this method of scripting the VS 2010 IDE: http://blogs.msdn.com/b/granth/archive/2009/09/25/scripting-team-project-creation-in-tfs2010.aspx. Ugly.
I'm keeping my fingers crossed that there's a better way. Ideas?
You can use this instead of the command line:
string log = @"C:\Builds\tfsLog.txt";
string settingsFilePath = @"C:\TeamProjects\TeamProjectSettings.xml";
var batchTeamProjectCreator = new BatchTeamProjectCreator();
var succes = batchTeamProjectCreator.BatchCreateTeamProject(settingsFilePath, out log);
you'll need to add a reference to this dll:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.TeamFoundation.TeamExplorer.dll
You will still need to use the xml, but its a bit more elegant.
Hope this is what you where looking for. :)
Good luck, Oshry
I am working on this recently, and I find a best solution:
- Install "Microsoft Team Foundation Server 2010 Power Tools" within your VS2010 box.
- Execute command:
\Program Files(x86)\Microsoft Team Foundation Server 2010 Power Tools\TFPT.exe createTeamProject /collection:http://vm-haitch:8080/tfs/TestCollection /TeamProject:Project1 /ProcessTemplate:"MSF for Agile Software Development v5.0" /SourceControl:New /log:C:\Temp\TFS\Auto\ /verbose /noreports /noportal
Apparently, I can't. The blog post mentioned in the question is the way to do it. There is a wrapper to that in the TFS PowerTools for 2010, but it does the same thing and the XML file creation is still necessary.
精彩评论