当前位置: 首页>>代码示例>>C#>>正文


C# System.Xml.XmlDocument.CreateComment方法代码示例

本文整理汇总了C#中System.Xml.XmlDocument.CreateComment方法的典型用法代码示例。如果您正苦于以下问题:C# System.Xml.XmlDocument.CreateComment方法的具体用法?C# System.Xml.XmlDocument.CreateComment怎么用?C# System.Xml.XmlDocument.CreateComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlDocument的用法示例。


在下文中一共展示了System.Xml.XmlDocument.CreateComment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MSBuildProject

        void IProject.Serialize()
        {
            System.Xml.XmlDocument xmlDocument = null;
            try
            {
                var projectLocationUri = new System.Uri(this.PathName, System.UriKind.RelativeOrAbsolute);

                xmlDocument = new System.Xml.XmlDocument();

                xmlDocument.AppendChild(xmlDocument.CreateComment("Automatically generated by BuildAMation v" + Bam.Core.State.VersionString));

                // TODO: this needs to be from the Toolset
                var versionString = DotNetFramework.DotNet.VersionString;
                var project = new MSBuildProject(xmlDocument, versionString);

                var generalGroup = project.CreatePropertyGroup();
                generalGroup.CreateProperty("ProjectGuid", this.ProjectGuid.ToString("B").ToUpper());
                // default configuration and platform
                {
                    var defaultConfiguration = generalGroup.CreateProperty("Configuration", "Debug");
                    defaultConfiguration.Condition = " '$(Configuration)' == '' ";
                }
                {
                    var defaultPlatform = generalGroup.CreateProperty("Platform", "AnyCPU");
                    defaultPlatform.Condition = " '$(Platform)' == '' ";
                }
                generalGroup.CreateProperty("TargetFrameworkVersion", "v" + versionString);

                // configurations
                // TODO: convert to var
                foreach (ProjectConfiguration configuration in this.ProjectConfigurations)
                {
                    configuration.SerializeCSBuild(project, projectLocationUri);
                }

                // source files
                if (this.SourceFileCollection.Count > 0)
                {
                    this.SourceFileCollection.SerializeCSBuild(project, projectLocationUri, this.PackageUri);
                }

                // application definition and page files
                if ((this.ApplicationDefinitionFile != null) ||
                    (this.PageFiles.Count > 0))
                {
                    var applicationDefinitionGroup = project.CreateItemGroup();

                    // application definition
                    if (this.ApplicationDefinitionFile != null)
                    {
                        var xamlRelativePath = Bam.Core.RelativePathUtilities.GetPath(this.ApplicationDefinitionFile.RelativePath, projectLocationUri);

                        var applicationDefinition = applicationDefinitionGroup.CreateItem("ApplicationDefinition", xamlRelativePath);
                        applicationDefinition.CreateMetaData("Generator", "MSBuild:Compile");
                        applicationDefinition.CreateMetaData("SubType", "Designer");

                        var sourcePathname = xamlRelativePath + ".cs";
                        var associatedSource = applicationDefinitionGroup.CreateItem("Compile", sourcePathname);
                        associatedSource.CreateMetaData("DependentUpon", System.IO.Path.GetFileName(xamlRelativePath));
                        associatedSource.CreateMetaData("SubType", "Code");
                    }

                    // page files
                    // TODO: convert to var
                    foreach (ProjectFile pageFile in this.PageFiles)
                    {
                        var xamlRelativePath = Bam.Core.RelativePathUtilities.GetPath(pageFile.RelativePath, projectLocationUri);

                        var applicationDefinition = applicationDefinitionGroup.CreateItem("Page", xamlRelativePath);
                        applicationDefinition.CreateMetaData("Generator", "MSBuild:Compile");
                        applicationDefinition.CreateMetaData("SubType", "Designer");

                        var sourcePathname = xamlRelativePath + ".cs";
                        var associatedSource = applicationDefinitionGroup.CreateItem("Compile", sourcePathname);
                        associatedSource.CreateMetaData("DependentUpon", System.IO.Path.GetFileName(xamlRelativePath));
                        associatedSource.CreateMetaData("SubType", "Code");
                    }
                }

                // project dependencies
                if (this.DependentProjectList.Count > 0)
                {
                    var dependencyItemGroup = project.CreateItemGroup();
                    foreach (var dependentProject in this.DependentProjectList)
                    {
                        var relativePath = Bam.Core.RelativePathUtilities.GetPath(dependentProject.PathName, this.PathName);
                        var projectReference = dependencyItemGroup.CreateItem("ProjectReference", relativePath);
                        projectReference.CreateMetaData("Project", dependentProject.Guid.ToString("B").ToUpper());
                        projectReference.CreateMetaData("Name", dependentProject.Name);
                    }
                }

                // project references
                if (this.ReferencesList.Count > 0)
                {
                    var referenceItemGroup = project.CreateItemGroup();
                    foreach (var reference in this.ReferencesList)
                    {
                        var noExtReference = reference;
                        if (noExtReference.EndsWith(".dll"))
//.........这里部分代码省略.........
开发者ID:markfinal,项目名称:bam-csharp,代码行数:101,代码来源:CSBuildProject.cs


注:本文中的System.Xml.XmlDocument.CreateComment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。