Esempio n. 1
0
        public static void ImportToCurrituck(Microsoft.TeamFoundation.WorkItemTracking.Client.Project VSTSProj, string witdFile)
        {
            try
            {
                /* first check if the FORM section has Layout in this.. this is possible if the customer
                 * doesn't modifies the generated WITD in Analyze phase
                 */
                Display.StartProgressDisplay(UtilityMethods.Format(
                                                 VSTSResource.VstsSchemaImporting, witdFile));
                string witDefinition;
                using (StreamReader stream = new StreamReader(witdFile))
                {
                    witDefinition = stream.ReadToEnd();
                }

                WorkItemTypeCollection wits = VSTSProj.WorkItemTypes;
                Logger.Write(LogSource.WorkItemTracking, TraceLevel.Verbose, "Provisioning Work Item Type : {0}", witdFile);

                wits.Import(witDefinition);
            }
            // Any changes made in this catch block should be reproduced in the below catch block too;
            // This is to get rid of the nonclscompliant message from FxCop
            catch (XmlSchemaValidationException e)
            {
                Logger.WriteException(LogSource.WorkItemTracking, e);
                string errMsg = UtilityMethods.Format(
                    VSTSResource.VstsWITValidationFailed, witdFile,
                    e.LineNumber, e.LinePosition, e.Message);
                Common.ConverterMain.MigrationReport.WriteIssue(string.Empty, errMsg, string.Empty, null,
                                                                IssueGroup.Witd.ToString(), ReportIssueType.Critical);

                throw new ConverterException(errMsg, e);
            }
            catch (Exception e)
            {
                Logger.WriteException(LogSource.WorkItemTracking, e);
                string errMsg = UtilityMethods.Format(
                    VSTSResource.VstsWITProvisionFailed, witdFile, e.Message);
                Common.ConverterMain.MigrationReport.WriteIssue(string.Empty,
                                                                errMsg, string.Empty, null, IssueGroup.Witd.ToString(), ReportIssueType.Critical);

                throw new ConverterException(errMsg, e);
            }
            finally
            {
                Logger.Write(LogSource.WorkItemTracking, TraceLevel.Verbose, "Work Item Type Provisioning Done : {0}", witdFile);
                Display.StopProgressDisplay();
            }
        } // end of ImportToCurrituck