Team System Developer Center >
Visual Studio Team System Forums
>
Team Foundation Server – Power Tools & Add-ons
>
Cannot create New Team Project with TFS power tools 2008
Cannot create New Team Project with TFS power tools 2008
- I am in the process of creating a new team project by executing the tfpt createteamproject command as a background process in my .net application. However, I get the following exception from the log :
2009-10-06 17:02:10Z | Module: Internal | Team Foundation Server proxy retrieved | Completion time: 0.140274 seconds 2009-10-06 17:02:10Z | Module: Internal | The template information for Team Foundation Server "http://vm-devt9:8080/tfs" was retrieved from the Team Foundation Server. | Completion time: 0.015586 seconds 2009-10-06 17:02:10Z | Module: Engine | Thread: 1 | New project will be created with the "MSF for Agile Software Development v5.0" methodology 2009-10-06 17:02:10Z | Module: Engine | Retrieved IAuthorizationService proxy | Completion time: 0.15586 seconds ---begin Exception entry--- Time: 2009-10-06 17:02:10Z Module: Engine Event Description: TF30226: User did not have project creation permissions Exception Type: System.Security.SecurityException Exception Message: TFXXXXXX: You cannot create team projects with this version of the Visual Studio Team System web service. Please upgrade your client to a version compatible with Visual Studio Team System 2010. Stack Trace: at Microsoft.TeamFoundation.Proxy.AuthorizationService.CheckPermission(String objectId, String actionId) at Microsoft.VisualStudio.TeamFoundation.SecurityHelper.UserHasCreatePermissions(ELeadLogger log) --- end Exception entry --- 2009-10-06 17:02:10Z | Module: Engine | Thread: 1 | TF30172: You do not have permission to create a new team project. 2009-10-06 17:02:10Z | Module: BatchTeamProjectCreator | Thread: 1 | Microsoft.VisualStudio.TeamFoundation.ProjectCreationException: TF30172: You do not have permission to create a new team project. at Microsoft.VisualStudio.TeamFoundation.EngineStarter.CheckPermissions() at Microsoft.VisualStudio.TeamFoundation.EngineStarter.CreateProject() at Microsoft.VisualStudio.TeamFoundation.BatchTeamProjectCreator.CreateProject() at Microsoft.VisualStudio.TeamFoundation.BatchTeamProjectCreator.BatchCreateTeamProject() at Microsoft.VisualStudio.TeamFoundation.BatchTeamProjectCreator.BatchCreateTeamProject(String teamProjectCreationSettingFile, String& logFileFullPath) 2009-10-06 17:02:10Z | Module: BatchTeamProjectCreator | Thread: 1 | Team Project Batch Creation failed.
Can anyone tell me wats wrong here?
Thanks,
Tara.
Answers
- You dont have to wait, the ability to create team projects has (finaly) moved into VSTS2010.
Read Grant Hollidays post on Scripting Team Project Creation in TFS2010 (http://blogs.msdn.com/granth/archive/2009/09/25/scripting-team-project-creation-in-tfs2010.aspx )
- Proposed As Answer byMattias Sköld Wednesday, October 07, 2009 6:01 AM
- Marked As Answer byhifunda Wednesday, October 07, 2009 6:08 AM
- Unmarked As Answer byhifunda Wednesday, October 07, 2009 6:09 AM
- Marked As Answer byhifunda Wednesday, October 07, 2009 6:52 AM
- At the moment - No,
VSTS2008 dont have the option to create teamprojects through code if you cant use the powertools.
VSTS2010 has this capability, I dont know if it is accessable directly from the TFS2010API or if ypu still have to do the scripting/xml part
A suggestion is to wrap tp creation in a class, and simply change the exe who actually performce the creation.
- Marked As Answer byhifunda Wednesday, October 07, 2009 6:52 AM
- Something like this ?
public class TFSCreateProjectWrapper { public string TFSServerUrl { get; set; } public TFSCreateProjectWrapper(string tfsServerUrl) { TFSServerUrl = tfsServerUrl; } public void CreateTeamProjectVS2010(string teamProjectName, string procTemplate) { Console.WriteLine("Creating teamproject config file"); string sXMlFile = @"<?xml version=""1.0"" encoding=""utf-8""?><Project xmlns=""ProjectCreationSettingsFileSchema.xsd"">"; sXMlFile += @"<TFSName>{0}</TFSName>"; sXMlFile+= @"<LogFolder>c:\temp</LogFolder>"; sXMlFile += @"<ProjectName>{1}</ProjectName>"; sXMlFile += @"<ProjectSiteEnabled>true</ProjectSiteEnabled>"; sXMlFile += @"<ProjectSiteTitle>{1}</ProjectSiteTitle>"; sXMlFile += @"<ProjectSiteDescription>{1} created from command line</ProjectSiteDescription>"; sXMlFile += @"<SccCreateType>New</SccCreateType>"; sXMlFile += @"<SccBranchFromPath></SccBranchFromPath>"; sXMlFile += @"<ProcessTemplateName>{2}</ProcessTemplateName>"; sXMlFile += @"</Project>"; sXMlFile= string.Format(sXMlFile, TFSServerUrl, teamProjectName, procTemplate); System.IO.FileStream file= new FileStream(@"c:\temp\pcw.xml", FileMode.Create); System.IO.StreamWriter fw = new StreamWriter(file); fw.Write(sXMlFile); fw.Close(); Console.WriteLine("Creating teamproject"); string sCommand = ""; string path = @"""C:\Program Files\\Microsoft Visual Studio 10.0\Common7\IDE\DEVENV.exe"" "; sCommand = path + @"/command ""File.BatchNewTeamProject C:\temp\pcw.xml"" "; Console.WriteLine("Executing " + sCommand); ExecuteCommandSync(sCommand); Console.WriteLine("Team project created "); } public void CreateTeamProjectTFPT(string teamProjectName, string procTemplate) { Console.WriteLine("Creating teamproject"); string sCommand = ""; string path = @"""C:\Program Files\Microsoft Team Foundation Server 2008 Power Tools\tfpt.exe"" "; sCommand = path + string.Format(@"createteamproject /server:{0} /teamproject:""{1}"" /processtemplate:""{2}"" /sourcecontrol:new ", TFSServerUrl, teamProjectName, procTemplate); Console.WriteLine("Executing " + sCommand); ExecuteCommandSync(sCommand); } public void CreateTeamProject(string teamProjectName, string procTemplate) { if (TFSServerUrl.Split(':')[2].LastIndexOf("/")>0 ) { CreateTeamProjectVS2010(teamProjectName, procTemplate); } else { CreateTeamProjectTFPT(teamProjectName, procTemplate); } } private string ExecuteCommandSync(string command) { try { // create the ProcessStartInfo using "cmd" as the program to be run, // and "/c " as the parameters. // Incidentally, /c tells cmd that we want it to execute the command that follows, // and then exit. ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", @"/c " + "\"" + command + "\""); // The following commands are needed to redirect the standard output. // This means that it will be redirected to the Process.StandardOutput StreamReader. procStartInfo.RedirectStandardOutput = true; procStartInfo.UseShellExecute = false; // Do not create the black window. procStartInfo.CreateNoWindow = true; // Now we create a process, assign its ProcessStartInfo and start it System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo = procStartInfo; proc.Start(); // Get the output into a string string result = proc.StandardOutput.ReadToEnd(); // Display the command output. Console.WriteLine("Teamproject creation result: " + result); return result; } catch (Exception objException) { return objException.Message; // Log the exception } } }
- Marked As Answer byhifunda Thursday, October 08, 2009 8:28 AM
All Replies
- Are you connected to a TFS 2010 server with Team Explorer 2008?
Ewald - Please remember to mark the replies as answers if they help.

Blog: www.ewaldhofman.nl Yes that's right. And, the fact is TF power tools aren't out for VS2010 yet and the only way to create a new team project via TFS SDK is to run this tfpt command as a background process in my .NET application. In the future, we are sooner or later going to have to upgrade to 2010 versions. Can you point what the above exception means? I have all permissions required.
- It is not that you are lacking permissions. Creating a team project from the 2008 SDK is not supported on a TFS 2010 installation.
The TFS 2010 power tools will be released a while after TFS 2010 is RTM. I suggest that you (if you really want to do this) use the TFS Object Model. TFS 2010 Beta 2 will arrive soon and the object model of Beta 2 won't have much compatibility issues with TFS 2010 RTM.
Unfortunately there is not much information yet available since TFS 2010 is Beta1 currently.
Ewald - Please remember to mark the replies as answers if they help.

Blog: www.ewaldhofman.nl - Yes you're absolutely right. Thanks a lot for ur quick replies. Currently there is no way to create a new team project using the TFS SDK alone..The only available option is using the power tools "tfpt.exe createteamproject" command. Do you know how long it will take for 2010 Power tools to get released? Or for the time being, I'll have to try with a 2008 TFS server...
There is no release date for the 2010 power tools yet.
Keep an eye on the blog of Brian Harry to see announcements of this kind: http://blogs.msdn.com/bharry
Ewald - Please remember to mark the replies as answers if they help.

Blog: www.ewaldhofman.nl- Okay thanks. What do you suggest I do for the time being? Connect to a 2008 server itself instead? Hopefully that shouldn't be a problem..
- What do you want to achieve?
Ewald - Please remember to mark the replies as answers if they help.

Blog: www.ewaldhofman.nl - My project basically involves using only the TFS API to manage some of the build tasks like selective builds of changesets,work item management etc., of which one of the steps is creating a new team project. But since this is not possible with the SDK, i found people employing the TF power tools command as a workaround which is not working out for me. Should I just stick to connecting to a 2008 server then?
- You dont have to wait, the ability to create team projects has (finaly) moved into VSTS2010.
Read Grant Hollidays post on Scripting Team Project Creation in TFS2010 (http://blogs.msdn.com/granth/archive/2009/09/25/scripting-team-project-creation-in-tfs2010.aspx )
- Proposed As Answer byMattias Sköld Wednesday, October 07, 2009 6:01 AM
- Marked As Answer byhifunda Wednesday, October 07, 2009 6:08 AM
- Unmarked As Answer byhifunda Wednesday, October 07, 2009 6:09 AM
- Marked As Answer byhifunda Wednesday, October 07, 2009 6:52 AM
I want to create the new project from VSTS 2008 by connecting to TFS 2010. Is this possible?? Coz I am getting exceptions regarding permissions..
Thanks for that link though. Very useful :)- At the moment - No,
VSTS2008 dont have the option to create teamprojects through code if you cant use the powertools.
VSTS2010 has this capability, I dont know if it is accessable directly from the TFS2010API or if ypu still have to do the scripting/xml part
A suggestion is to wrap tp creation in a class, and simply change the exe who actually performce the creation.
- Marked As Answer byhifunda Wednesday, October 07, 2009 6:52 AM
- Well, that's bad news for me. I am going to try what you suggested with that link. I had actually not wanted to use that option of a project settings file, but now I don't have any other option.
By the way, I was trying to execute the tfpt command as a process in my .NET application only, but since it gave exceptions I tried using the command prompt first. Is this what you meant by "wrapping project creation in a class"?
"simply change the exe who actually performce the creation." ----- what does this mean?? - Something like this ?
public class TFSCreateProjectWrapper { public string TFSServerUrl { get; set; } public TFSCreateProjectWrapper(string tfsServerUrl) { TFSServerUrl = tfsServerUrl; } public void CreateTeamProjectVS2010(string teamProjectName, string procTemplate) { Console.WriteLine("Creating teamproject config file"); string sXMlFile = @"<?xml version=""1.0"" encoding=""utf-8""?><Project xmlns=""ProjectCreationSettingsFileSchema.xsd"">"; sXMlFile += @"<TFSName>{0}</TFSName>"; sXMlFile+= @"<LogFolder>c:\temp</LogFolder>"; sXMlFile += @"<ProjectName>{1}</ProjectName>"; sXMlFile += @"<ProjectSiteEnabled>true</ProjectSiteEnabled>"; sXMlFile += @"<ProjectSiteTitle>{1}</ProjectSiteTitle>"; sXMlFile += @"<ProjectSiteDescription>{1} created from command line</ProjectSiteDescription>"; sXMlFile += @"<SccCreateType>New</SccCreateType>"; sXMlFile += @"<SccBranchFromPath></SccBranchFromPath>"; sXMlFile += @"<ProcessTemplateName>{2}</ProcessTemplateName>"; sXMlFile += @"</Project>"; sXMlFile= string.Format(sXMlFile, TFSServerUrl, teamProjectName, procTemplate); System.IO.FileStream file= new FileStream(@"c:\temp\pcw.xml", FileMode.Create); System.IO.StreamWriter fw = new StreamWriter(file); fw.Write(sXMlFile); fw.Close(); Console.WriteLine("Creating teamproject"); string sCommand = ""; string path = @"""C:\Program Files\\Microsoft Visual Studio 10.0\Common7\IDE\DEVENV.exe"" "; sCommand = path + @"/command ""File.BatchNewTeamProject C:\temp\pcw.xml"" "; Console.WriteLine("Executing " + sCommand); ExecuteCommandSync(sCommand); Console.WriteLine("Team project created "); } public void CreateTeamProjectTFPT(string teamProjectName, string procTemplate) { Console.WriteLine("Creating teamproject"); string sCommand = ""; string path = @"""C:\Program Files\Microsoft Team Foundation Server 2008 Power Tools\tfpt.exe"" "; sCommand = path + string.Format(@"createteamproject /server:{0} /teamproject:""{1}"" /processtemplate:""{2}"" /sourcecontrol:new ", TFSServerUrl, teamProjectName, procTemplate); Console.WriteLine("Executing " + sCommand); ExecuteCommandSync(sCommand); } public void CreateTeamProject(string teamProjectName, string procTemplate) { if (TFSServerUrl.Split(':')[2].LastIndexOf("/")>0 ) { CreateTeamProjectVS2010(teamProjectName, procTemplate); } else { CreateTeamProjectTFPT(teamProjectName, procTemplate); } } private string ExecuteCommandSync(string command) { try { // create the ProcessStartInfo using "cmd" as the program to be run, // and "/c " as the parameters. // Incidentally, /c tells cmd that we want it to execute the command that follows, // and then exit. ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", @"/c " + "\"" + command + "\""); // The following commands are needed to redirect the standard output. // This means that it will be redirected to the Process.StandardOutput StreamReader. procStartInfo.RedirectStandardOutput = true; procStartInfo.UseShellExecute = false; // Do not create the black window. procStartInfo.CreateNoWindow = true; // Now we create a process, assign its ProcessStartInfo and start it System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo = procStartInfo; proc.Start(); // Get the output into a string string result = proc.StandardOutput.ReadToEnd(); // Display the command output. Console.WriteLine("Teamproject creation result: " + result); return result; } catch (Exception objException) { return objException.Message; // Log the exception } } }
- Marked As Answer byhifunda Thursday, October 08, 2009 8:28 AM
- oh thanks a lot mattias. Really appreciate it. I can use this. Currently, my server has VS 2010 beta installed, but it doesn't seem to be able to open my existing VS 2008 solution file.
The fact is i have written all my existing code in 2008 on my pc, and now i have to migrate this code to VS 2010 on the server machine to execute this new command. What should I do? oh thanks a lot mattias. Really appreciate it. I can use this. Currently, my server has VS 2010 beta installed, but it doesn't seem to be able to open my existing VS 2008 solution file.
The fact is i have written all my existing code in 2008 on my pc, and now i have to migrate this code to VS 2010 on the server machine to execute this new command. What should I do?
No you dont have to migrate your code, this class works fine in vs2008.
The only thing you need is to have the vsts2010 beta installed on the client running your program, if you connect to a tfs2010.
Strange if you cant get Vs2010 to open your solution ? Have you tried to manually select file/open solution ?
VSTS2010 vill show you the upgrade wizard, for moving your solution, its not the fact that yo will have to upgrade you mean ?
Strange if you cant get Vs2010 to open your solution ? Have you tried to manually select file/open solution ?
VSTS2010 vill show you the upgrade wizard, for moving your solution, its not the fact that yo will have to upgrade you mean ?
I just realized that only Team Explorer had been installed. Will get Team System installed soon and try it out. My code was ready and I dont really want it to be a class wrapper as this is only one of the steps involved in my project. It is there in my form code. So I tweaked it to just accommodate the new command.


