TFS 2015 - tfpt Create new Team Project

2019-05-29 23:51发布

问题:

Trying to create a powershell script to create a new project in Team Foundation Server 2015.

When running the script I get the message:

The project collection does not have a default location for creating project portal sites configured. Either configure this location using the Team Foundation Administration Console or specify the /webapplication and /relativepath arguments.

Any suggestions, I want to create a new git repository instead of needing to use Visual Studio.

My create new project script.

[CmdletBinding()]
Param(
  [Parameter(Mandatory=$True,Position=1)]
   [string]$name
)
Write-Host "Create new project: $name";
tfpt createteamproject /collection:'http://localhost:8080/tfs/DefaultCollection' /teamproject:"$name" /processtemplate:'scrum' /sourcecontrol:'NewGitRepo'

回答1:

If you need to create a new Git repository, there's no need to create a new Team Project. You can add as many Git repos as you want to a single project.

In the web portal, visit the "Code" tab, click on the active repository (in the top left) and click on the "New Repository" button.



回答2:

To extend Daniel Manns answer:

You can add new repositories to an existing Team Project from the project administration page using the New Repository button

http://tfsserver:8080/tfs/[CollectionName]/[ProjectName]/_admin/_versioncontrol

There does not seem to be any way to create a new Team Project nor add a new repository using TFPT, but the latter is possible thanks to this:

TfsGitAdmin

You will end up with a repo url something like

http://tfsserver:8080/tfs/[CollectionName]/[ProjectName]/_git/[NewProjectName]


One (possibly major) downside to adding a repository this way is that it doesn't seem to be accessible to Code Reviews, at least not in TFS 2013.

The new repository is a bit difficult to find through the Portal interface. It's hiding under the (usually redundant) Team Project dropdown.

This is the same in TFS 2015



回答3:

just add the /noportal parameter, which indicates that the project does not require site in Sharepoint. It worked for me.



回答4:

You need details for the SharePoint configuration. Try to run the script with adding arguments?
[/webapplication:http://sharepoint.domain.local] and [/relativepath:/sites/DefaultCollection/MyProject].
You can checkout msdn site and an old but still relevant blog