示例#1
0
        public WebServerProvider()
        {
            string vs2005 = String.Format(
                CultureInfo.InvariantCulture,
                @"%SystemRoot%\Microsoft.NET\Framework\v{0}\WebDev.WebServer.exe",
                FrameworkVersionTypeConverter.LatestMatching("2"));

            vs2005 = Resolve(vs2005);

            string vs2008 = Path.Combine(CommonProgramFiles(), @"Microsoft Shared\DevServer\9.0\WebDev.WebServer.exe");
            string vs2010 = Path.Combine(CommonProgramFiles(), @"Microsoft Shared\DevServer\10.0\WebDev.WebServer40.exe");

            webServers = new List <IntegratedWebServer>();
            webServers.Add(new IntegratedWebServer(vs2010));
            webServers.Add(new IntegratedWebServer(vs2008));
            webServers.Add(new IntegratedWebServer(vs2005));
        }
示例#2
0
        //=====================================================================

        /// <summary>
        /// This is used to perform the actual conversion
        /// </summary>
        /// <returns>The new project filename on success.  An exception is
        /// thrown if the conversion fails.</returns>
        public override string ConvertProject()
        {
            XPathDocument     sourceFile;
            XPathNavigator    navNDoc;
            SearchOption      searchOpts;
            SandcastleProject project = base.Project;
            FileItem          fileItem;
            List <string>     syntaxFilters = new List <string> {
                "CSharp", "VisualBasic", "CPlusPlus"
            };
            string assemblyName, commentsName, folderName, value, destFile,
                   propName = null;

            string[] list;

            try
            {
                sourceFile = new XPathDocument(base.OldProjectFile);
                navNDoc    = sourceFile.CreateNavigator();

                // Add the assemblies
                foreach (XPathNavigator assembly in navNDoc.Select(
                             "project/assemblies/assembly"))
                {
                    assemblyName = this.FullPath(
                        assembly.GetAttribute("location", String.Empty));
                    commentsName = this.FullPath(
                        assembly.GetAttribute("documentation", String.Empty));

                    if (!String.IsNullOrEmpty(assemblyName))
                    {
                        project.DocumentationSources.Add(assemblyName, null,
                                                         null, false);
                    }

                    if (!String.IsNullOrEmpty(commentsName))
                    {
                        project.DocumentationSources.Add(commentsName, null,
                                                         null, false);
                    }
                }

                // Add reference paths
                foreach (XPathNavigator reference in navNDoc.Select(
                             "project/referencePaths/referencePath"))
                {
                    folderName = this.FullPath(reference.GetAttribute(
                                                   "path", String.Empty));

                    if (folderName.EndsWith("\\**", StringComparison.Ordinal))
                    {
                        searchOpts = SearchOption.AllDirectories;
                        folderName = folderName.Substring(0,
                                                          folderName.Length - 3);
                    }
                    else
                    {
                        searchOpts = SearchOption.TopDirectoryOnly;
                    }

                    foreach (string refFile in Directory.GetFiles(
                                 folderName, "*.dll", searchOpts))
                    {
                        Project.References.AddReference(
                            Path.GetFileNameWithoutExtension(refFile), refFile);
                    }
                }

                // Add the namespace summaries
                foreach (XPathNavigator ns in navNDoc.Select(
                             "project/namespaces/namespace"))
                {
                    if (!String.IsNullOrEmpty(ns.InnerXml))
                    {
                        project.NamespaceSummaries.Add(ns.GetAttribute("name",
                                                                       String.Empty), true, ns.InnerXml);
                    }
                }

                // Add one for the global namespace if it isn't there
                if (project.NamespaceSummaries[String.Empty] == null)
                {
                    project.NamespaceSummaries.Add(String.Empty, false,
                                                   String.Empty);
                }

                project.NamespaceSummaries.Sort();

                // Add options from the MSDN documenters.  This will be a
                // merger of all the documenters present in the file since
                // we can't tell which one is the active one.  The file can
                // be edited by hand to delete unwanted documenters or
                // properties before converting it.
                foreach (XPathNavigator node in navNDoc.Select(
                             "project/documenters/documenter[@name=\"MSDN\" or " +
                             "@name=\"MSDN-CHM\" or @name=\"VS.NET 2003\" or " +
                             "@name=\"MSDN 2003\"]"))
                {
                    foreach (XPathNavigator child in node.Select("*"))
                    {
                        propName = child.GetAttribute("name", String.Empty);

                        switch (propName)
                        {
                        case "AdditionalContentResourceDirectory":
                            this.ConvertAdditionalContent(child.GetAttribute(
                                                              "value", String.Empty));
                            break;

                        case "BinaryTOC":
                            project.BinaryTOC = Convert.ToBoolean(
                                child.GetAttribute("value", String.Empty),
                                CultureInfo.InvariantCulture);
                            break;

                        case "CleanIntermediates":
                            project.CleanIntermediates = Convert.ToBoolean(
                                child.GetAttribute("value", String.Empty),
                                CultureInfo.InvariantCulture);
                            break;

                        case "CopyrightHref":
                            project.CopyrightHref = child.GetAttribute(
                                "value", String.Empty);
                            break;

                        case "CopyrightText":
                            project.CopyrightText = child.GetAttribute(
                                "value", String.Empty);
                            break;

                        case "DocumentAttributes":
                            project.DocumentAttributes = Convert.ToBoolean(
                                child.GetAttribute("value", String.Empty),
                                CultureInfo.InvariantCulture);
                            break;

                        case "DocumentExplicitInterfaceImplementations":
                            project.DocumentExplicitInterfaceImplementations =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "DocumentInheritedMembers":
                            project.DocumentInheritedMembers =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "DocumentInheritedFrameworkMembers":
                            project.DocumentInheritedFrameworkMembers =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "DocumentInternals":
                            project.DocumentInternals = Convert.ToBoolean(
                                child.GetAttribute("value", String.Empty),
                                CultureInfo.InvariantCulture);
                            break;

                        case "DocumentPrivates":
                            project.DocumentPrivates = Convert.ToBoolean(
                                child.GetAttribute("value", String.Empty),
                                CultureInfo.InvariantCulture);
                            break;

                        case "DocumentProtected":
                            project.DocumentProtected = Convert.ToBoolean(
                                child.GetAttribute("value", String.Empty),
                                CultureInfo.InvariantCulture);
                            break;

                        case "DocumentProtectedInternalAsProtected":
                            project.DocumentProtectedInternalAsProtected =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "DocumentSealedProtected":
                            project.DocumentSealedProtected =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "FeedbackEmailAddress":
                            project.FeedbackEMailAddress =
                                child.GetAttribute("value", String.Empty);
                            break;

                        case "HtmlHelpName":
                            project.HtmlHelpName = child.GetAttribute(
                                "value", String.Empty);
                            break;

                        case "IncludeFavorites":
                            project.IncludeFavorites = Convert.ToBoolean(
                                child.GetAttribute("value", String.Empty),
                                CultureInfo.InvariantCulture);
                            break;

                        case "OutputDirectory":
                            folderName = child.GetAttribute("value",
                                                            String.Empty);

                            if (folderName != @".\doc\")
                            {
                                project.OutputPath = new FolderPath(
                                    folderName, project);
                            }
                            break;

                        case "Preliminary":
                            project.Preliminary = Convert.ToBoolean(
                                child.GetAttribute("value", String.Empty),
                                CultureInfo.InvariantCulture);
                            break;

                        case "Title":
                            value = child.GetAttribute("value", String.Empty);

                            if (value != "An NDoc Documented Class Library" &&
                                value != "An NDoc documented library")
                            {
                                project.HelpTitle = value;
                            }
                            break;

                        case "RootPageContainsNamespaces":
                            project.RootNamespaceContainer =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "RootPageFileName":
                            value = this.FullPath(child.GetAttribute(
                                                      "value", String.Empty));
                            destFile = Path.Combine(base.ProjectFolder,
                                                    Path.GetFileName(value));
                            project.AddFileToProject(value, destFile);
                            break;

                        case "RootPageTOCName":
                            project.RootNamespaceTitle = child.GetAttribute(
                                "value", String.Empty);
                            break;

                        case "FilesToInclude":
                            foreach (string filename in child.GetAttribute(
                                         "value", String.Empty).Split(new char[] { '|' }))
                            {
                                value    = this.FullPath(filename.Trim());
                                destFile = Path.Combine(base.ProjectFolder,
                                                        Path.GetFileName(value));
                                project.AddFileToProject(value, destFile);
                            }
                            break;

                        case "AutoDocumentConstructors":
                            project.AutoDocumentConstructors =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "ShowMissingSummaries":
                            project.ShowMissingSummaries =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "ShowMissingRemarks":
                            project.ShowMissingRemarks =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "ShowMissingParams":
                            project.ShowMissingParams =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "ShowMissingReturns":
                            project.ShowMissingReturns =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "ShowMissingValues":
                            project.ShowMissingValues =
                                Convert.ToBoolean(child.GetAttribute(
                                                      "value", String.Empty),
                                                  CultureInfo.InvariantCulture);
                            break;

                        case "ShowVisualBasic":
                            if (child.GetAttribute("value", String.Empty) == "False")
                            {
                                syntaxFilters.Remove("VisualBasic");
                            }
                            break;

                        case "AboutPageIconPage":
                        case "AboutPageInfo":
                        case "EmptyIndexTermPage":
                        case "IntroductionPage":
                        case "NavFailPage":
                            value = this.FullPath(child.GetAttribute(
                                                      "value", String.Empty));
                            destFile = Path.Combine(base.ProjectFolder,
                                                    Path.GetFileName(value));
                            fileItem = project.AddFileToProject(value,
                                                                destFile);
                            fileItem.ExcludeFromToc = true;
                            break;

                        case "CollectionTOCStyle":
                            project.CollectionTocStyle =
                                (CollectionTocStyle)Enum.Parse(
                                    typeof(CollectionTocStyle),
                                    child.GetAttribute("value", String.Empty),
                                    true);
                            break;

                        case "DocSetList":
                            list = child.GetAttribute("value",
                                                      String.Empty).Split(',');

                            foreach (string docSet in list)
                            {
                                project.HelpAttributes.Add("DocSet",
                                                           docSet.Trim());
                            }
                            break;

                        case "IncludeDefaultStopWordList":
                            project.IncludeStopWordList = Convert.ToBoolean(
                                child.GetAttribute("value", String.Empty),
                                CultureInfo.InvariantCulture);
                            break;

                        case "Version":
                            project.HelpFileVersion = child.GetAttribute(
                                "value", String.Empty);
                            break;

                        case "OutputTarget":
                            value = child.GetAttribute("value", String.Empty);

                            if (value == "HtmlHelp")
                            {
                                project.HelpFileFormat = HelpFileFormat.HtmlHelp1;
                            }
                            else
                            if (value == "Web")
                            {
                                project.HelpFileFormat = HelpFileFormat.Website;
                            }
                            else
                            {
                                project.HelpFileFormat = HelpFileFormat.HtmlHelp1 |
                                                         HelpFileFormat.Website;
                            }
                            break;

                        case "SdkDocLanguage":
                            project.Language = new CultureInfo(
                                child.GetAttribute("value", String.Empty));
                            break;

                        case "SdkDocVersion":
                            value = child.GetAttribute("value",
                                                       String.Empty).Substring(5).Replace('_', '.');
                            project.FrameworkVersion = FrameworkVersionTypeConverter.LatestMatching(value);
                            break;

                        case "SdkLinksOnWeb":
                            if (child.GetAttribute("value", String.Empty) == "True")
                            {
                                project.HtmlSdkLinkType         = project.WebsiteSdkLinkType = HtmlSdkLinkType.Msdn;
                                project.MSHelp2SdkLinkType      = MSHelp2SdkLinkType.Msdn;
                                project.MSHelpViewerSdkLinkType = MSHelpViewerSdkLinkType.Msdn;
                            }
                            else
                            {
                                project.HtmlSdkLinkType         = project.WebsiteSdkLinkType = HtmlSdkLinkType.None;
                                project.MSHelp2SdkLinkType      = MSHelp2SdkLinkType.Index;
                                project.MSHelpViewerSdkLinkType = MSHelpViewerSdkLinkType.Id;
                            }
                            break;

                        default:
                            break;
                        }
                    }
                }

                // Set the syntax filters
                project.SyntaxFilters = String.Join(", ", syntaxFilters.ToArray());

                base.CreateFolderItems();
                project.SaveProject(project.Filename);
            }
            catch (Exception ex)
            {
                throw new BuilderException("CVT0005", String.Format(
                                               CultureInfo.CurrentCulture, "Error reading project " +
                                               "from '{0}' (last property = {1}):\r\n{2}",
                                               base.OldProjectFile, propName, ex.Message), ex);
            }

            return(project.Filename);
        }
示例#3
0
        /// <summary>
        /// Import the assemblies information for the specified Visual
        /// Studio project file.
        /// </summary>
        /// <param name="projectFile">The project file from which to
        /// load the assembly information.</param>
        /// <param name="projectConfigs">The project list</param>
        private void ImportFromVSProject(string projectFile,
                                         List <ProjectConfigItem> projectConfigs)
        {
            StreamReader        sr = null;
            XmlNamespaceManager nsm;
            XmlDocument         sourceFile = new XmlDocument();
            XmlNodeList         builds;
            XmlNode             assemblyNode, outputTypeNode, pathNode, docNode,
                                settingsNode;
            XmlAttribute assemblyAttr, outputTypeAttr, pathAttr, docAttr;
            string       assembly, folder;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                sr = new StreamReader(projectFile);
                sourceFile.Load(sr);

                folder = Path.GetDirectoryName(projectFile) + "\\";

                // Visual Studio 2003 or 2005?
                if (sourceFile.ChildNodes[0].Name == "VisualStudioProject")
                {
                    // VS 2003 so use .NET 1.1
                    project.FrameworkVersion =
                        FrameworkVersionTypeConverter.LatestMatching("1.1");

                    settingsNode = sourceFile.SelectSingleNode(
                        "//VisualStudioProject/*/Build/Settings");
                    builds = sourceFile.SelectNodes(
                        "//VisualStudioProject/*/Build/Settings/*");

                    if (settingsNode != null)
                    {
                        assemblyAttr   = settingsNode.Attributes["AssemblyName"];
                        outputTypeAttr = settingsNode.Attributes["OutputType"];
                    }
                    else
                    {
                        assemblyAttr = outputTypeAttr = null;
                    }

                    // Ignore the project if these aren't found
                    if (assemblyAttr == null || outputTypeAttr == null ||
                        builds.Count == 0)
                    {
                        return;
                    }

                    if (outputTypeAttr.Value == "Library")
                    {
                        assembly = assemblyAttr.Value + ".dll";
                    }
                    else
                    {
                        assembly = assemblyAttr.Value + ".exe";
                    }

                    // Get the configuration, assembly, and XML comment info
                    foreach (XmlNode build in builds)
                    {
                        pathAttr = build.Attributes["OutputPath"];
                        docAttr  = build.Attributes["DocumentationFile"];

                        if (pathAttr != null && docAttr != null &&
                            docAttr.Value.Length != 0)
                        {
                            projectConfigs.Add(new ProjectConfigItem(
                                                   build.Attributes["Name"].Value,
                                                   folder + pathAttr.Value + assembly,
                                                   folder + docAttr.Value));
                        }
                    }
                }
                else
                {
                    // VS 2005 so use .NET 2.0
                    project.FrameworkVersion =
                        FrameworkVersionTypeConverter.LatestMatching("2.0");

                    nsm = new XmlNamespaceManager(sourceFile.NameTable);
                    nsm.AddNamespace("prj",
                                     sourceFile.DocumentElement.NamespaceURI);

                    assemblyNode = sourceFile.SelectSingleNode(
                        "//prj:Project/prj:PropertyGroup/prj:AssemblyName",
                        nsm);
                    outputTypeNode = sourceFile.SelectSingleNode(
                        "//prj:Project/prj:PropertyGroup/prj:OutputType",
                        nsm);
                    builds = sourceFile.SelectNodes(
                        "//prj:Project/prj:PropertyGroup[@Condition != '']",
                        nsm);

                    // Ignore the project if these aren't found
                    if (assemblyNode == null || outputTypeNode == null ||
                        builds.Count == 0)
                    {
                        return;
                    }

                    if (outputTypeNode.InnerText == "Library")
                    {
                        assembly = assemblyNode.InnerText + ".dll";
                    }
                    else
                    {
                        assembly = assemblyNode.InnerText + ".exe";
                    }

                    // Get the configuration, assembly, and XML comment info
                    foreach (XmlNode build in builds)
                    {
                        pathNode = build.SelectSingleNode("prj:OutputPath",
                                                          nsm);
                        docNode = build.SelectSingleNode(
                            "prj:DocumentationFile", nsm);

                        if (pathNode != null && docNode != null &&
                            docNode.InnerText.Length != 0)
                        {
                            projectConfigs.Add(new ProjectConfigItem(
                                                   build.Attributes["Condition"].Value,
                                                   folder + pathNode.InnerText + assembly,
                                                   folder + docNode.InnerText));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Write(ex);
                MessageBox.Show(ex.Message, Constants.AppName,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }

                this.Cursor = Cursors.Default;
            }
        }
示例#4
0
        /// <summary>
        /// Replace a field tag with a value from the project
        /// </summary>
        /// <param name="match">The match that was found</param>
        /// <returns>The string to use as the replacement</returns>
        private string OnFieldMatch(Match match)
        {
            string replaceWith;

            switch (match.Groups["Field"].Value.ToLower(
                        CultureInfo.InvariantCulture))
            {
            case "shfbfolder":
                replaceWith = shfbFolder;
                break;

            case "projectfolder":
                replaceWith = Path.GetDirectoryName(project.Filename);
                if (replaceWith.Length == 0)
                {
                    replaceWith = Directory.GetCurrentDirectory();
                }

                replaceWith += @"\";
                break;

            case "outputfolder":
                replaceWith = outputFolder;
                break;

            case "workingFolder":
                replaceWith = workingFolder;
                break;

            case "sandcastlepath":
                replaceWith = sandcastleFolder;
                break;

            case "presentationpath":
                replaceWith = presentationFolder;
                break;

            case "presentationstyle":
                replaceWith = project.PresentationStyle;
                break;

            case "hhcpath":
                replaceWith = hhcFolder;
                break;

            case "hxcomppath":
                replaceWith = hxcompFolder;
                break;

            case "dependencies":
                // If there are any, the dependencies have already been
                // copied to the .\DLL sub-folder in the working folder.
                if (project.Dependencies.Count == 0)
                {
                    replaceWith = String.Empty;
                }
                else
                {
                    replaceWith = @"/dep:DLL\*.*";
                }
                break;

            case "docinternals":
                if (project.DocumentInternals || project.DocumentPrivates)
                {
                    replaceWith = "/internal+";
                }
                else
                {
                    replaceWith = String.Empty;
                }
                break;

            case "htmlhelpname":
                replaceWith = project.HtmlHelpName;
                break;

            case "commentfilelist":
                replaceWith = project.Assemblies.CommentFileList(
                    workingFolder);
                break;

            case "helptitle":
                replaceWith = project.HelpTitle;
                break;

            case "htmlenchelptitle":
                replaceWith = HttpUtility.HtmlEncode(project.HelpTitle);
                break;

            case "urlenchelptitle":     // Just replace "&" for now
                replaceWith = project.HelpTitle.Replace("&", "%26");
                break;

            case "rootnamespacetitle":
                replaceWith = project.RootNamespaceTitle;

                if (replaceWith.Length == 0)
                {
                    replaceWith = "<include item=\"rootTopicTitleLocalized\"/>";
                }
                break;

            case "binarytoc":
                replaceWith = project.BinaryTOC ? "Yes" : "No";
                break;

            case "windowoptions":
                // Currently, we use a default set of options and only
                // allow showing or hiding the Favorites tab.
                replaceWith = (project.IncludeFavorites) ? "0x63520" : "0x62520";
                break;

            case "langid":
                replaceWith = language.LCID.ToString(
                    CultureInfo.InvariantCulture);
                break;

            case "language":
                replaceWith = String.Format(CultureInfo.InvariantCulture,
                                            "0x{0:X} {1}", language.LCID, language.NativeName);
                break;

            case "locale":
                replaceWith = language.Name.ToLower(
                    CultureInfo.InvariantCulture);
                break;

            case "copyright":
                // Include copyright info if there is a copyright HREF or
                // copyright text.
                if (project.CopyrightHref.Length != 0 ||
                    project.CopyrightText.Length != 0)
                {
                    replaceWith = "<include item=\"copyright\"/>";
                }
                else
                {
                    replaceWith = String.Empty;
                }
                break;

            case "copyrightinfo":
                if (project.CopyrightHref.Length == 0 &&
                    project.CopyrightText.Length == 0)
                {
                    replaceWith = String.Empty;
                }
                else
                if (project.CopyrightHref.Length == 0)
                {
                    replaceWith = project.DecodedCopyrightText;
                }
                else
                if (project.CopyrightText.Length == 0)
                {
                    replaceWith = project.CopyrightHref;
                }
                else
                {
                    replaceWith = String.Format(
                        CultureInfo.CurrentCulture, "{0} ({1})",
                        project.DecodedCopyrightText,
                        project.CopyrightHref);
                }
                break;

            case "htmlenccopyrightinfo":
                if (project.CopyrightHref.Length == 0 &&
                    project.CopyrightText.Length == 0)
                {
                    replaceWith = String.Empty;
                }
                else
                if (project.CopyrightHref.Length == 0)
                {
                    replaceWith = "<p/>" + HttpUtility.HtmlEncode(
                        project.DecodedCopyrightText);
                }
                else
                if (project.CopyrightText.Length == 0)
                {
                    replaceWith = String.Format(
                        CultureInfo.CurrentCulture,
                        "<p/><a href='{0}'>{0}</a>",
                        HttpUtility.HtmlEncode(
                            project.CopyrightHref));
                }
                else
                {
                    replaceWith = String.Format(
                        CultureInfo.CurrentCulture,
                        "<p/><a href='{0}'>{1}</a>",
                        HttpUtility.HtmlEncode(
                            project.CopyrightHref),
                        HttpUtility.HtmlEncode(
                            project.DecodedCopyrightText));
                }
                break;

            case "copyrighthref":
                replaceWith = project.CopyrightHref;
                break;

            case "htmlenccopyrighthref":
                if (project.CopyrightHref.Length == 0)
                {
                    replaceWith = String.Empty;
                }
                else
                {
                    replaceWith = String.Format(
                        CultureInfo.CurrentCulture,
                        "<a href='{0}'>{0}</a>", HttpUtility.HtmlEncode(
                            project.CopyrightHref));
                }
                break;

            case "copyrighttext":
                if (project.CopyrightText.Length == 0)
                {
                    replaceWith = String.Empty;
                }
                else
                {
                    replaceWith = project.DecodedCopyrightText;
                }
                break;

            case "htmlenccopyrighttext":
                if (project.CopyrightText.Length == 0)
                {
                    replaceWith = String.Empty;
                }
                else
                {
                    replaceWith = HttpUtility.HtmlEncode(
                        project.DecodedCopyrightText);
                }
                break;

            case "comments":
                // Include "send comments" line if feedback e-mail address
                // is specified.
                if (project.FeedbackEMailAddress.Length != 0)
                {
                    replaceWith = "<include item=\"comments\"/>";
                }
                else
                {
                    replaceWith = String.Empty;
                }
                break;

            case "feedbackemailaddress":
                replaceWith = project.FeedbackEMailAddress;
                break;

            case "urlencfeedbackemailaddress":
                if (project.FeedbackEMailAddress.Length == 0)
                {
                    replaceWith = String.Empty;
                }
                else
                {
                    replaceWith = HttpUtility.UrlEncode(
                        project.FeedbackEMailAddress);
                }
                break;

            case "htmlencfeedbackemailaddress":
                if (project.FeedbackEMailAddress.Length == 0)
                {
                    replaceWith = String.Empty;
                }
                else
                {
                    replaceWith = HttpUtility.HtmlEncode(
                        project.FeedbackEMailAddress);
                }
                break;

            case "headertext":
                replaceWith = project.HeaderText;
                break;

            case "footertext":
                replaceWith = project.FooterText;
                break;

            case "preliminary":
                // Include the "preliminary" warning in the header text if wanted
                if (project.Preliminary)
                {
                    replaceWith = "<include item=\"preliminary\"/>";
                }
                else
                {
                    replaceWith = String.Empty;
                }
                break;

            case "defaulttopic":
                replaceWith = defaultTopic;
                break;

            case "webdefaulttopic":
                replaceWith = defaultTopic.Replace(@"\", "/");
                break;

            case "frameworkversion":
                replaceWith = project.FrameworkVersion;

                // For .NET 3.0, Microsoft says to use the .NET 2.0
                // framework files.
                if (replaceWith[0] == '3')
                {
                    replaceWith = FrameworkVersionTypeConverter.LatestMatching("2.0");
                }
                break;

            case "frameworkversionshort":
                replaceWith = project.FrameworkVersion.Substring(0, 3);

                // For .NET 3.0, Microsoft says to use the .NET 2.0
                // framework files.
                if (replaceWith[0] == '3')
                {
                    replaceWith = "2.0";
                }
                break;

            case "help1xprojectfiles":
                replaceWith = BuildProcess.HelpProjectFileList(
                    workingFolder + @"Output\", HelpFileFormat.HtmlHelp1x);
                break;

            case "help2xprojectfiles":
                replaceWith = BuildProcess.HelpProjectFileList(
                    workingFolder + @"Output\", HelpFileFormat.HtmlHelp2x);
                break;

            case "projectlinks":
                replaceWith = project.ProjectLinkType.ToString().ToLower(
                    CultureInfo.InvariantCulture);
                break;

            case "sdklinks":
                replaceWith = project.SdkLinkType.ToString().ToLower(
                    CultureInfo.InvariantCulture);
                break;

            case "htmltoc":
                replaceWith = this.GenerateHtmlToc();
                break;

            case "syntaxfilters":
                replaceWith = String.Empty;

                if ((project.SyntaxFilters & SyntaxFilters.CSharp) != 0)
                {
                    replaceWith += "<generator type=\"Microsoft.Ddue." +
                                   "Tools.CSharpDeclarationSyntaxGenerator\" " +
                                   "assembly=\"" + sandcastleFolder +
                                   "ProductionTools\\SyntaxComponents.dll\" />\r\n";
                }

                if ((project.SyntaxFilters & SyntaxFilters.VisualBasic) != 0)
                {
                    replaceWith += "<generator type=\"Microsoft.Ddue." +
                                   "Tools.VisualBasicDeclarationSyntaxGenerator\" " +
                                   "assembly=\"" + sandcastleFolder +
                                   "ProductionTools\\SyntaxComponents.dll\" />\r\n";
                }

                if ((project.SyntaxFilters & SyntaxFilters.CPlusPlus) != 0)
                {
                    replaceWith += "<generator type=\"Microsoft.Ddue." +
                                   "Tools.CPlusPlusDeclarationSyntaxGenerator\" " +
                                   "assembly=\"" + sandcastleFolder +
                                   "ProductionTools\\SyntaxComponents.dll\" />\r\n";
                }

                if ((project.SyntaxFilters & SyntaxFilters.JSharp) != 0)
                {
                    replaceWith += "<generator type=\"Microsoft.Ddue." +
                                   "Tools.JSharpDeclarationSyntaxGenerator\" " +
                                   "assembly=\"" + sandcastleFolder +
                                   "ProductionTools\\SyntaxComponents.dll\" />\r\n";
                }
                break;

            case "syntaxfiltersdropdown":
                replaceWith = String.Empty;

                // Note that we can't remove the dropdown box if only
                // a single language is selected as script still
                // depends on it.
                if ((project.SyntaxFilters & SyntaxFilters.CSharp) != 0)
                {
                    replaceWith += "<language label=\"CSharp\" " +
                                   "name=\"CSharp\" style=\"cs\" />\r\n";
                }

                if ((project.SyntaxFilters & SyntaxFilters.VisualBasic) != 0)
                {
                    replaceWith += "<language label=\"VisualBasic\" " +
                                   "name=\"VisualBasic\" style=\"vb\" />\r\n";
                }

                if ((project.SyntaxFilters & SyntaxFilters.CPlusPlus) != 0)
                {
                    replaceWith += "<language label=\"ManagedCPlusPlus\" " +
                                   "name=\"ManagedCPlusPlus\" style=\"cs\" />\r\n";
                }

                if ((project.SyntaxFilters & SyntaxFilters.JSharp) != 0)
                {
                    replaceWith += "<language label=\"JSharp\" " +
                                   "name=\"JSharp\" style=\"cs\" />\r\n";
                }
                break;

            case "autodocumentconstructors":
                replaceWith = project.AutoDocumentConstructors.ToString().
                              ToLower(CultureInfo.InvariantCulture);
                break;

            case "showmissingparams":
                replaceWith = project.ShowMissingParams.ToString().
                              ToLower(CultureInfo.InvariantCulture);
                break;

            case "showmissingremarks":
                replaceWith = project.ShowMissingRemarks.ToString().
                              ToLower(CultureInfo.InvariantCulture);
                break;

            case "showmissingreturns":
                replaceWith = project.ShowMissingReturns.ToString().
                              ToLower(CultureInfo.InvariantCulture);
                break;

            case "showmissingsummaries":
                replaceWith = project.ShowMissingSummaries.ToString().
                              ToLower(CultureInfo.InvariantCulture);
                break;

            case "showmissingvalues":
                replaceWith = project.ShowMissingValues.ToString().
                              ToLower(CultureInfo.InvariantCulture);
                break;

            default:
                throw new BuilderException(String.Format(
                                               CultureInfo.CurrentCulture,
                                               "Unknown field tag: '{0}'",
                                               match.Groups["Field"].Value));
            }

            return(replaceWith);
        }