本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}