本文整理汇总了C#中Microsoft.Build.BuildEngine.Project.TryGetEvaluatedItemByNameBatched方法的典型用法代码示例。如果您正苦于以下问题:C# Project.TryGetEvaluatedItemByNameBatched方法的具体用法?C# Project.TryGetEvaluatedItemByNameBatched怎么用?C# Project.TryGetEvaluatedItemByNameBatched使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.BuildEngine.Project
的用法示例。
在下文中一共展示了Project.TryGetEvaluatedItemByNameBatched方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToITaskItemArray
public ITaskItem [] ConvertToITaskItemArray (Project project, ExpressionOptions options)
{
BuildItemGroup group;
if (project.TryGetEvaluatedItemByNameBatched (itemName, out group))
return group.ConvertToITaskItemArray (transform, separator, options);
else
return null;
}
示例2: ConvertToString
// when evaluating property, allowItems=false, so,
// ItemRef will _not_ get created, so this wont get hit
// when evaluating items, expand: true
// other cases, expand: true
public string ConvertToString (Project project, ExpressionOptions options)
{
BuildItemGroup group;
if (project.TryGetEvaluatedItemByNameBatched (itemName, out group))
return group.ConvertToString (transform, separator, options);
else
return String.Empty;
}
示例3: ConvertToITaskItemArray
public ITaskItem [] ConvertToITaskItemArray (Project project, ExpressionOptions options)
{
List<ITaskItem> items = new List<ITaskItem> ();
if (IsQualified) {
// Bucket would have item lists with same metadata values,
// so just get the value from the first item
BuildItemGroup group;
if (project.TryGetEvaluatedItemByNameBatched (itemName, out group))
BuildItemGroupToITaskItems (group, items, true);
} else {
// Get unique metadata values from _all_ item lists
foreach (BuildItemGroup group in project.GetAllItemGroups ())
BuildItemGroupToITaskItems (group, items, false);
}
return items.Count == 0 ? null : items.ToArray ();
}
示例4: ContainsItem
bool ContainsItem (Project project, ITaskItem taskItem)
{
BuildItemGroup group;
if (!project.TryGetEvaluatedItemByNameBatched (Name, out group))
return false;
var item = group.FindItem (taskItem);
if (item == null)
return false;
foreach (string metadataName in evaluatedMetadata.Keys) {
string metadataValue = (string)evaluatedMetadata [metadataName];
if (!metadataValue.Equals (item.evaluatedMetadata [metadataName]))
return false;
}
foreach (string metadataName in item.evaluatedMetadata.Keys) {
string metadataValue = (string)item.evaluatedMetadata [metadataName];
if (!metadataValue.Equals (evaluatedMetadata [metadataName]))
return false;
}
return true;
}
示例5: RemoveItems
void RemoveItems (Project project)
{
BuildItemGroup group;
if (!project.TryGetEvaluatedItemByNameBatched (Name, out group))
return;
var removeExpr = new Expression ();
removeExpr.Parse (Remove, ParseOptions.AllowItemsNoMetadataAndSplit);
var removes = (ITaskItem[]) removeExpr.ConvertTo (
project, typeof (ITaskItem[]), ExpressionOptions.ExpandItemRefs);
var directoryScanner = new DirectoryScanner ();
directoryScanner.Includes = removes;
if (project.FullFileName != String.Empty)
directoryScanner.BaseDirectory = new DirectoryInfo (Path.GetDirectoryName (project.FullFileName));
else
directoryScanner.BaseDirectory = new DirectoryInfo (Directory.GetCurrentDirectory ());
directoryScanner.Scan ();
foreach (ITaskItem matchedItem in directoryScanner.MatchedItems) {
group.RemoveItem (matchedItem);
}
}
示例6: UpdateMetadata
void UpdateMetadata (Project project)
{
BuildItemGroup group;
if (!project.TryGetEvaluatedItemByNameBatched (Name, out group))
return;
foreach (BuildItem item in group) {
if (!item.CheckCondition (project))
continue;
foreach (string name in evaluatedMetadata.Keys) {
item.SetMetadata (name, (string)evaluatedMetadata [name]);
}
AddAndRemoveMetadata (project, item);
}
}