Create Associate a Project Server Project with a Team Project occur error

Apr 22, 2010 at 2:55 AM
Edited Apr 22, 2010 at 8:49 AM

I have installed ps2007 server、tfs2008、connector on the same machine,when i enter Connector website,i can see ps'project and tfs'project which i created, but i hit Save button to create a associate,tell me follow error message:

Ensure that the 'templateName' property has been added to your project."

I want to kown  the below code from lfenster' blog should be write into which file?

Modifying your application

Now that you can rely on the fact that a property named templateName will exist for a team project, you can use the projectproperties out parameter instead of templateId when calling the GetProjectProperties method on the ICommonStructureService interface.  Your code for obtaining the template information used to look something like:

string name = String.Empty;
string state = String.Empty
int templateId = 0;
ProjectProperty[] projectProperties = null;
CommonStructureService.GetProjectProperties(projectUri, out name, out state, out templateId, out projectProperties);

TemplateHeader[] headers = ProcessTemplates.TemplateHeaders(); 
List<TemplateHeader> templateHeaders = new List<TemplateHeader>(headers);
TemplateHeader template = null;
if ((null != templateHeaders) && (templateId > 0))
{
    template = templateHeaders.Find(delegate(TemplateHeader templateHeader) { return templateHeader.TemplateId == templateId; });
}

return template;

Now, you will want to use the projectProperties instead of the templateId.  So, the code following the call to GetProjectProperties should be changed to look more like:

List<ProjectProperty> projectPropertiesList = new List<ProjectProperty>(projectProperties);
ProjectProperty templateNameProp = projectPropertiesList.Find(delegate(ProjectProperty property) { return property.Name.Equals("templateName"); });
if (null != templateNameProp)
{           
    string templateName = templateNameProp.Value;
    TemplateHeader[] headers = ProcessTemplates.TemplateHeaders(); 
    List<TemplateHeader> templateHeaders = new List<TemplateHeader>(headers);
    TemplateHeader template = null;
    if (null != templateHeaders)
    {
        template = templateHeaders.Find(delegate(TemplateHeader templateHeader) { return templateHeader.Name.Equals(templateName); });
    }
}

return template;

 

 thanks.

Apr 24, 2010 at 5:57 AM

I have resolved this problem.