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


C# ProjectRootElement.CreateElement方法代码示例

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


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

示例1: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectMetadataElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to a parent.
        /// </summary>
        internal static ProjectMetadataElement CreateDisconnected(string name, ProjectRootElement containingProject)
        {
            XmlUtilities.VerifyThrowArgumentValidElementName(name);
            ErrorUtilities.VerifyThrowArgument(!FileUtilities.ItemSpecModifiers.IsItemSpecModifier(name), "ItemSpecModifierCannotBeCustomMetadata", name);
            ErrorUtilities.VerifyThrowInvalidOperation(XMakeElements.IllegalItemPropertyNames[name] == null, "CannotModifyReservedItemMetadata", name);

            XmlElementWithLocation element = containingProject.CreateElement(name);

            return new ProjectMetadataElement(element, containingProject);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:14,代码来源:ProjectMetadataElement.cs

示例2: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectOnErrorElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to a parent.
        /// </summary>
        internal static ProjectOnErrorElement CreateDisconnected(string executeTargets, ProjectRootElement containingProject)
        {
            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.onError);

            ProjectOnErrorElement onError = new ProjectOnErrorElement(element, containingProject);

            onError.ExecuteTargetsAttribute = executeTargets;

            return onError;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:14,代码来源:ProjectOnErrorElement.cs

示例3: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectImportElement, wrapping an unparented XmlElement.
        /// Validates the project value.
        /// Caller should then ensure the element is added to a parent
        /// </summary>
        internal static ProjectImportElement CreateDisconnected(string project, ProjectRootElement containingProject)
        {
            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.import);

            ProjectImportElement import = new ProjectImportElement(element, containingProject);

            import.Project = project;

            return import;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:15,代码来源:ProjectImportElement.cs

示例4: CreateDisconnected

        /// <summary>
        /// Creates an unparented UsingTaskParameterElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to a parent.
        /// </summary>
        internal static ProjectUsingTaskParameterElement CreateDisconnected(string parameterName, string output, string required, string parameterType, ProjectRootElement containingProject)
        {
            XmlUtilities.VerifyThrowArgumentValidElementName(parameterName);
            XmlElementWithLocation element = containingProject.CreateElement(parameterName);
            ProjectUsingTaskParameterElement parameter = new ProjectUsingTaskParameterElement(element, containingProject);
            parameter.Output = output;
            parameter.Required = required;
            parameter.ParameterType = parameterType;

            return parameter;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:15,代码来源:ProjectUsingTaskParameterElement.cs

示例5: CreateDisconnected

        /// <summary>
        /// Creates an unparented UsingTaskParameterGroupElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to a parent
        /// </summary>
        internal static UsingTaskParameterGroupElement CreateDisconnected(ProjectRootElement containingProject)
        {
            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.usingTaskParameterGroup);

            return new UsingTaskParameterGroupElement(element, containingProject);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:10,代码来源:UsingTaskParameterGroupElement.cs

示例6: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectItemDefinitionElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to a parent.
        /// </summary>
        internal static ProjectItemDefinitionElement CreateDisconnected(string itemType, ProjectRootElement containingProject)
        {
            XmlUtilities.VerifyThrowArgumentValidElementName(itemType);

            // Orcas inadvertently did not check for reserved item types (like "Choose") in item definitions,
            // as we do for item types in item groups. So we do not have a check here.
            // Although we could perhaps add one, as such item definitions couldn't be used 
            // since no items can have the reserved itemType.
            XmlElementWithLocation element = containingProject.CreateElement(itemType);

            return new ProjectItemDefinitionElement(element, containingProject);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:16,代码来源:ProjectItemDefinitionElement.cs

示例7: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectExtensionsElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to a parent
        /// </summary>
        internal static ProjectExtensionsElement CreateDisconnected(ProjectRootElement containingProject)
        {
            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.projectExtensions);

            return new ProjectExtensionsElement(element, containingProject);
        }
开发者ID:cdmihai,项目名称:msbuild,代码行数:10,代码来源:ProjectExtensionsElement.cs

示例8: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectPropertyElement, wrapping an unparented XmlElement.
        /// Validates name.
        /// Caller should then ensure the element is added to the XmlDocument in the appropriate location.
        /// </summary>
        internal static ProjectPropertyElement CreateDisconnected(string name, ProjectRootElement containingProject)
        {
            XmlUtilities.VerifyThrowArgumentValidElementName(name);

            ErrorUtilities.VerifyThrowInvalidOperation(XMakeElements.IllegalItemPropertyNames[name] == null && !ReservedPropertyNames.IsReservedProperty(name), "OM_CannotCreateReservedProperty", name);

            XmlElementWithLocation element = containingProject.CreateElement(name);

            return new ProjectPropertyElement(element, containingProject);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:15,代码来源:ProjectPropertyElement.cs

示例9: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectUsingTaskElement, wrapping an unparented XmlElement.
        /// Validates the parameters.
        /// Exactly one of assembly file and assembly name must have a value.
        /// Caller should then ensure the element is added to a parent
        /// </summary>
        internal static ProjectUsingTaskElement CreateDisconnected(string taskName, string assemblyFile, string assemblyName, string runtime, string architecture, ProjectRootElement containingProject)
        {
            ErrorUtilities.VerifyThrowArgument
            (
            (String.IsNullOrEmpty(assemblyFile) ^ String.IsNullOrEmpty(assemblyName)),
            "OM_EitherAttributeButNotBoth",
            XMakeElements.usingTask,
            XMakeAttributes.assemblyFile,
            XMakeAttributes.assemblyName
            );

            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.usingTask);

            ProjectUsingTaskElement usingTask = new ProjectUsingTaskElement(element, containingProject);

            usingTask.TaskName = taskName;
            usingTask.Runtime = runtime;
            usingTask.Architecture = architecture;

            if (!String.IsNullOrEmpty(assemblyFile))
            {
                usingTask.AssemblyFile = assemblyFile;
            }
            else
            {
                usingTask.AssemblyName = assemblyName;
            }

            return usingTask;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:36,代码来源:ProjectUsingTaskElement.cs

示例10: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectTaskElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to the XmlDocument in the appropriate location.
        /// </summary>
        /// <remarks>
        /// Any legal XML element name is allowed. We can't easily verify if the name is a legal XML element name,
        /// so this will specifically throw XmlException if it isn't.
        /// </remarks>
        internal static ProjectTaskElement CreateDisconnected(string name, ProjectRootElement containingProject)
        {
            ErrorUtilities.VerifyThrowArgumentLength(name, "name");

            XmlElementWithLocation element = containingProject.CreateElement(name);

            return new ProjectTaskElement(element, containingProject);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:16,代码来源:ProjectTaskElement.cs

示例11: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectOtherwiseElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to a parent.
        /// </summary>
        internal static ProjectOtherwiseElement CreateDisconnected(ProjectRootElement containingProject)
        {
            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.otherwise);

            return new ProjectOtherwiseElement(element, containingProject);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:10,代码来源:ProjectOtherwiseElement.cs

示例12: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectOutputElement, wrapping an unparented XmlElement.
        /// Validates the parameters.
        /// Exactly one of item name and property name must have a value.
        /// Caller should then ensure the element is added to a parent
        /// </summary>
        internal static ProjectOutputElement CreateDisconnected(string taskParameter, string itemType, string propertyName, ProjectRootElement containingProject)
        {
            ErrorUtilities.VerifyThrowArgument
                (
                (String.IsNullOrEmpty(itemType) ^ String.IsNullOrEmpty(propertyName)),
                "OM_EitherAttributeButNotBoth",
                XMakeElements.output,
                XMakeAttributes.propertyName,
                XMakeAttributes.itemName
                );

            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.output);

            ProjectOutputElement output = new ProjectOutputElement(element, containingProject);

            output.TaskParameter = taskParameter;

            if (!String.IsNullOrEmpty(itemType))
            {
                output.ItemType = itemType;
            }
            else
            {
                output.PropertyName = propertyName;
            }

            return output;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:34,代码来源:ProjectOutputElement.cs

示例13: CreateDisconnected

 /// <summary>
 /// Creates an unparented ProjectUsingTaskBodyElement, wrapping an unparented XmlElement.
 /// Validates name.
 /// Caller should then ensure the element is added to the XmlDocument in the appropriate location.
 /// </summary>
 internal static ProjectUsingTaskBodyElement CreateDisconnected(string evaluate, string body, ProjectRootElement containingProject)
 {
     XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.usingTaskBody);
     ProjectUsingTaskBodyElement taskElement = new ProjectUsingTaskBodyElement(element, containingProject);
     taskElement.Evaluate = evaluate;
     taskElement.TaskBody = body;
     return taskElement;
 }
开发者ID:cameron314,项目名称:msbuild,代码行数:13,代码来源:ProjectUsingTaskBodyElement.cs

示例14: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectTargetElement, wrapping an unparented XmlElement.
        /// Validates the name.
        /// Caller should then ensure the element is added to a parent.
        /// </summary>
        internal static ProjectTargetElement CreateDisconnected(string name, ProjectRootElement containingProject)
        {
            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.target);

            ProjectTargetElement target = new ProjectTargetElement(element, containingProject);

            target.Name = name;

            return target;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:15,代码来源:ProjectTargetElement.cs

示例15: CreateDisconnected

        /// <summary>
        /// Creates an unparented ProjectItemGroupElement, wrapping an unparented XmlElement.
        /// Caller should then ensure the element is added to the XmlDocument in the appropriate location.
        /// </summary>
        internal static ProjectItemGroupElement CreateDisconnected(ProjectRootElement containingProject)
        {
            XmlElementWithLocation element = containingProject.CreateElement(XMakeElements.itemGroup);

            return new ProjectItemGroupElement(element, containingProject);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:10,代码来源:ProjectItemGroupElement.cs


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