ProjectMetadata 类

定义

计算的设计时元数据。An evaluated design-time metadatum. ProjectItemDefinition 或 ProjectItem 的父级。Parented either by a ProjectItemDefinition or a ProjectItem.

public ref class ProjectMetadata : IEquatable<Microsoft::Build::Evaluation::ProjectMetadata ^>
public class ProjectMetadata : IEquatable<Microsoft.Build.Evaluation.ProjectMetadata>
type ProjectMetadata = class
    interface IEquatable<ProjectMetadata>
Public Class ProjectMetadata
Implements IEquatable(Of ProjectMetadata)
继承
ProjectMetadata
实现

注解

从不用于表示内置元数据,如% (Filename) 。Never used to represent built-in metadata, like %(Filename). 始终存在一个支持 XML 对象。There is always a backing XML object.

属性

ConditionLocation

Condition 属性的位置Location of the condition attribute

EvaluatedValue

获取计算的元数据值。Gets the evaluated metadata value. 不能直接设置:只能设置未计算的值。Cannot be set directly: only the unevaluated value can be set. 决不会为 null。Is never null.

IsImported

如果元值源自一个导入的文件,则返回 true。If the metadatum originated in an imported file, returns true. 否则,返回 False。Otherwise returns false.

ItemType

父项定义或项的项目类型。The item type of the parent item definition or item.

Location

元素的位置Location of the element

Name

元数据的名称Name of the metadata

Predecessor

在计算期间由此元数据重写的(项定义或项中的)任何上一个元数据。Any immediately previous metadatum (from item definition or item) that was overridden by this one during evaluation. 这将包括在逻辑项目文件上具有相同名称的所有元数据,这些元数据属于同一类型的项定义,其条件计算结果为 true。This would include all metadata with the same name that lie above in the logical project file, who are on item definitions of the same type, and whose conditions evaluated to true. 如果对某一项使用了此元数据,则会在其条件计算结果为 true 的同一项上包含具有相同名称的任何以前的元数据,后跟任何项定义元数据。If this metadatum is on an item, it would include any previous metadatum with the same name on the same item whose condition evaluated to true, and following that any item definition metadata. 如果上面没有任何值,则为 null。If there are none above this is null. 如果自上次修改后未重新计算项目,则此值可能不正确。If the project has not been reevaluated since the last modification this value may be incorrect.

Project

此元类型所在的项目。Project that this metadatum lives in. ProjectMetadata 始终位于项目中。ProjectMetadata's always live in a project.

UnevaluatedValue

获取或设置未计算的元数据值。Gets or sets the unevaluated metadata value.

除了更新未计算的值,资源库还更新已计算的值,但在重新计算之前不会影响项目中的任何其他内容。As well as updating the unevaluated value, the setter updates the evaluated value, but does not affect anything else in the project until reevaluation. 例如,如果对“i”类型的项修改了名为“m”的元数据,则在重新评估之前,它不会影响从“@(j->'%(m)')”计算出的“j”。For example, --if a piece of metadata named "m" is modified on item of type "i", it does not affect "j" which is evaluated from "@(j->'%(m)')" until reevaluation. 如果将“m”的未计算值设置为通过计算修改的内容(如“$(p)”),则在重新评估之前,计算的值将设置为“$(p)”。--if the unevaluated value of "m" is set to something that is modified by evaluation, such as "$(p)", the evaluated value will be set to "$(p)" until reevaluation. 当然,这是一种很方便的方法,它不一定会使项目处于完全一致的状态。This is a convenience that it is understood does not necessarily leave the project in a perfectly self consistent state.

如果基础 ProjectItemElement 源自项目列表、通配符或分号表达式,则通过 ProjectItem 设置元数据可能会导致基础 ProjectItem 被拆分,因为很明显,调用方只打算影响那个特定的项。Setting metadata through a ProjectItem may cause the underlying ProjectItemElement to be split, if it originated with an itemlist, wildcard, or semicolon expression, because it was clear that the caller intended to only affect that particular item. 通过 ProjectMetadata 设置元数据不会导致任何拆分,因为我们假定调用方大致预期会影响使用基础 ProjectMetadataElement 的所有项。Setting metadata through a ProjectMetadata does not cause any splitting, because we assume the caller presumably intends to affect all items using the underlying ProjectMetadataElement. 至少这看起来是一个合理的假设,它不需要元数据保存指向其包含项的指针。At least, this seems a reasonable assumption, and it avoids the need for metadata to hold a pointer to their containing items.

Xml

支持 XML 元数据。Backing XML metadata. 决不能为 null。Can never be null.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

IEquatable<ProjectMetadata>.Equals(ProjectMetadata)

将此元数据与另一个元数据进行比较,确定是否相等。Compares this metadata to another for equivalence.

适用于