本文整理汇总了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"))
//.........这里部分代码省略.........