Esempio n. 1
0
        private static void SetProcessConfiguration(Project project, WorkItemConfigurationItemType type, WorkItemConfigurationItem item)
        {
            var tfs           = project.Store.TeamProjectCollection;
            var configService = tfs.GetService <ProjectProcessConfigurationService>();

            try
            {
                if (type == WorkItemConfigurationItemType.CommonConfiguration)
                {
                    CommonProjectConfiguration commonConfig;
                    using (var xmlStringReader = new StringReader(item.XmlDefinition.DocumentElement.OuterXml))
                        using (var xmlReader = XmlReader.Create(xmlStringReader))
                        {
                            while (xmlReader.NodeType != XmlNodeType.Element)
                            {
                                xmlReader.Read();
                            }
                            commonConfig = CommonProjectConfiguration.FromXml(tfs, xmlReader);
                        }
                    configService.SetCommonConfiguration(project.Uri.ToString(), commonConfig);
                }
                else if (type == WorkItemConfigurationItemType.AgileConfiguration)
                {
                    AgileProjectConfiguration agileConfig;
                    using (var xmlStringReader = new StringReader(item.XmlDefinition.DocumentElement.OuterXml))
                        using (var xmlReader = XmlReader.Create(xmlStringReader))
                        {
                            while (xmlReader.NodeType != XmlNodeType.Element)
                            {
                                xmlReader.Read();
                            }
                            agileConfig = AgileProjectConfiguration.FromXml(tfs, xmlReader);
                        }
                    configService.SetAgileConfiguration(project.Uri.ToString(), agileConfig);
                }
                else if (type == WorkItemConfigurationItemType.ProcessConfiguration)
                {
                    ProjectProcessConfiguration processConfig;
                    using (var xmlStringReader = new StringReader(item.XmlDefinition.DocumentElement.OuterXml))
                        using (var xmlReader = XmlReader.Create(xmlStringReader))
                        {
                            while (xmlReader.NodeType != XmlNodeType.Element)
                            {
                                xmlReader.Read();
                            }
                            processConfig = ProjectProcessConfiguration.FromXml(tfs, xmlReader);
                        }
                    configService.SetProcessConfiguration(project.Uri.ToString(), processConfig);
                }
                else
                {
                    throw new ArgumentException("The type argument must be either a CommonConfiguration, AgileConfiguration or ProcessConfiguration.");
                }
            }
            catch (NullReferenceException exc)
            {
                // Working with the ProjectProcessConfigurationService throws NullReferenceException on TFS 2010 or earlier.
                throw new InvalidOperationException("The process configuration could not be saved.", exc);
            }
        }
 [Configure(Optimization.Debug)] // MISMATCH!
 public override void ConfigureReleaseWin64(CommonProjectConfiguration conf, Target target)
 {
     base.ConfigureReleaseWin64(conf, target);
     conf.LogCaller(MethodBase.GetCurrentMethod());
 }
 public virtual void ConfigureReleaseWin64(CommonProjectConfiguration conf, Target target)
 {
     conf.LogCaller(MethodBase.GetCurrentMethod());
 }